SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 1999
    Location
    Highlands Ranch, CO
    Posts
    193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not good at javascript, and this code was generated by Image Ready. Could someone help me figure out why I get this error (only produced in netscape):

    JavaScript Error:
    line 20:

    document[changeImages.arguments[ i]] has no properties.

    --------------
    Here is the code: line 20 is bolded

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    
    function newImage(arg) {
    	if (document.images) {
    		rslt = new Image();
    		rslt.src = arg;
    		return rslt;
    	}
    }
    
    function changeImages() {
    	if (document.images && (preloadFlag == true)) {
    		for (var i=0; i<changeImages.arguments.length; i+=2) {
    			document[changeImages.arguments[ i]].src = changeImages.arguments[i+1];
    		}
    	}
    }
    
    var preloadFlag = false;
    function preloadImages() {
    	if (document.images) {
    		wet2_copy_01_over = newImage("images/wet2-copy_01-over.gif");
    		wet2_copy_02_wet2_copy_01_over = newImage("images/wet2-copy_02-wet2-copy_01_o.gif");
    		wet2_copy_02_wet2_copy_05_over = newImage("images/wet2-copy_02-wet2-copy_05_o.gif");
    		wet2_copy_03_wet2_copy_01_over = newImage("images/wet2-copy_03-wet2-copy_01_o.gif");
    		wet2_copy_03_over = newImage("images/wet2-copy_03-over.gif");
    		wet2_copy_03_wet2_copy_05_over = newImage("images/wet2-copy_03-wet2-copy_05_o.gif");
    		wet2_copy_04_wet2_copy_03_over = newImage("images/wet2-copy_04-wet2-copy_03_o.gif");
    		wet2_copy_04_wet2_copy_05_over = newImage("images/wet2-copy_04-wet2-copy_05_o.gif");
    		wet2_copy_04_wet2_copy_08_over = newImage("images/wet2-copy_04-wet2-copy_08_o.gif");
    		wet2_copy_05_over = newImage("images/wet2-copy_05-over.gif");
    		wet2_copy_05_wet2_copy_08_over = newImage("images/wet2-copy_05-wet2-copy_08_o.gif");
    		wet2_copy_06_wet2_copy_05_over = newImage("images/wet2-copy_06-wet2-copy_05_o.gif");
    		wet2_copy_06_wet2_copy_07_over = newImage("images/wet2-copy_06-wet2-copy_07_o.gif");
    		wet2_copy_07_over = newImage("images/wet2-copy_07-over.gif");
    		wet2_copy_08_wet2_copy_03_over = newImage("images/wet2-copy_08-wet2-copy_03_o.gif");
    		wet2_copy_08_over = newImage("images/wet2-copy_08-over.gif");
    		wet2_copy_08_wet2_copy_09_over = newImage("images/wet2-copy_08-wet2-copy_09_o.gif");
    		wet2_copy_09_wet2_copy_08_over = newImage("images/wet2-copy_09-wet2-copy_08_o.gif");
    		wet2_copy_09_over = newImage("images/wet2-copy_09-over.gif");
    		wet2_copy_09_wet2_copy_07_over = newImage("images/wet2-copy_09-wet2-copy_07_o.gif");
    		preloadFlag = true;
    	}
    }
    
    // -->
    </SCRIPT>
    ---------

    Here is one of the lines that calls the code:

    Code:
    <A HREF="contact.htm"
    				ONMOUSEOVER="changeImages('wet2_copy_08', 'images/wet2-copy_08-wet2-copy_09_o.gif', 'wet2_copy_09', 'images/wet2-copy_09-over.gif'); return true;"
    				ONMOUSEOUT="changeImages('wet2_copy_08', 'images/wet2-copy_08.gif', 'wet2_copy_09', 'images/wet2-copy_09.gif'); return true;">
    ------------

    Thanks for any help!

    Chad

    PS note that I had to put a space in the bracketed 'i' argument (in this post) to keep it from being interpreted as a bb tag for italic.

    [Edited by Chad J on 10-29-2000 at 10:21 PM]

  2. #2
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    I am having similar problems. I have some javascript code that works perfect in IE, but when I view it in Netscape 4.75 it takes me to a error 404, saying it cant find the script its pointing to. Is there some kind of plug-in that Netscape needs to be able to read javascript?

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Apparently, this is a bug in Netscape. I've had the exact same problem in doing mouseovers. Netscape's implementation of this javascript is apparently incomplete.

    If anyone else knows differently, please let us know! I'd like to be able to fix this on my site as well.

    m.

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I've got a question first. What sort of arguments are you passing?

    A no properties error usually implies that either the function is being called before the html was read or that something is incorrectly defined. Since the line is within a function, I presume the latter. What you can do for starts is place the following alerts just before line 20:

    alert(document[changeImages.arguments[ i]].src);
    alert(changeImages.arguments[i+1]);

    Also, there is no need to state "changeImages.arguments..." since the statement is within the function and the DOM is implied. Finally, if you are sending an image identifier and a source, you can try rewriting the function to read:



    function changeImages()
    {
    if (document.images && (preloadFlag == true))
    for (var i=0; i < arguments.length; i+=2)
    document.images[arguments[ i]].src = arguments[i+1];
    }

    Note: the above would only work if the 'odd' i's are identifiers (either numbers or image tag names) and the 'even' i's are the source for that image tag.

    Hope this helps
    Vinny


    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •