#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14

    Netscape refuses to cooperate with my JavaScript


    I have a page where, midway through the code there is a JavaScript statement that should change one of the images displayed on the page, similar to performing a rollover, but just executed as the page is being rendered in this case, not in reponse to an event. Here is the statement:

    Code:
    eval( "document.images[ '" + window.currentPage + "' ].src = window." + window.currentPage + "_on.src;" );
    This works in IE but does nothing in Netscape (no action, no error). The annoying thing about it is that an exactly equivalent statement works to perform rollovers on the page. Here is that code:

    Code:
    eval( "document.images[ '" + slice + "' ].src = window." + slice + "_" + dir + ".src;" );
    The part of the statement that is
    Code:
    + "_" + dir + ".src;"
    in the second statement is hardwired as
    Code:
    + "_on.src;"
    in the first statement.

    Is this just (yet another) case of Netscape being arbitrarily defective?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    Nevermind. I resolved the issue by moving the problematic JavaScript code further down in my HTML code which, for no reason, made it work.

IMN logo majestic logo threadwatch logo seochat tools logo