Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    406
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript not working in NN 4.7

    I have the following portion of javascript and in NN 4.7 it gives an error.

    The Code:
    img name="fullDocImageCit"
    if (document.images[fullDocImageCit]) {
    document.fullDocImageCit[0].src="avtop.gif"

    And in NN 4.7 it says
    document.fullDocImageCit[0] has no properties

    I know somethng is wrong in the way I wrote the [fullDocImageCit] but dont know how to fix it.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    487
    Thanks
    0
    Thanked 54 Times in 53 Posts
    document.images[fullDocImageCit] will use the value stored in the variable named fullDocImageCit. presumably that variable doesn't exist so it's filling it in with "undefined" or some such.

    document.images["fullDocImageCit"] will use the string value "fullDocImageCit" and may give you what you want.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    document.fullDocImageCit[0].src is an IE only shortcut. You've got the right reference in the IF statement but then jump to the wrong (proprietary) reference afterwards.

    document.images[fullDocImageCit].src will work and it'll fix the same problem which would appear in a modern browser, not just that obsolete antique NS 4.7.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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