www.webdeveloper.com
Results 1 to 6 of 6

Thread: IE Says I have a script error... but everything seems to work??

  1. #1
    Join Date
    Sep 2007
    Location
    Brisbane, Australia
    Posts
    3

    IE Says I have a script error... but everything seems to work??

    Hi all,

    I am very lame on javascript so please be kind if this is really simple. I hope someone can shed some light on a little problem for me.

    I have been playing around with a javascript image changing script for a few days and while the page seems to work just fine IE6 & IE7 both give me a script error while Firefox ect seem 100% fine.

    The script in question simply allows a user to click on any of a number of thumbnails and have the corrosponding full sized image appear next to it by changing the main image just like a simple photo gallery.

    You can have a look at the page and code here: http://gihweb.com/_testsites/EPATANT/models/atestmodel1/index.php


    Error In IE6 & IE7:
    Line: 78
    Char:1
    Error: 'document.images.pimage1' is null or not an object
    Code:0

    Thanks in advance to anyone offering a fix.

    Regards
    Steve

    My apologies... link has been corrected
    Last edited by GetITHappening; 09-07-2007 at 01:13 AM.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Link does not work
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Sep 2007
    Location
    Brisbane, Australia
    Posts
    3
    My apologies... link has been corrected

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Youv'e using a reference before it's available in IE
    Code:
    // This defines the source of the preview image 
    document.images['pimage1'].src=image1.src;
    document.images['pimage2'].src=image2.src;
    document.images['pimage3'].src=image3.src;
    document.images['pimage4'].src=image4.src;
    document.images['pimage5'].src=image5.src;
    document.images['pimage6'].src=image6.src;
    I don't even think it's necessary.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  5. #5
    Join Date
    May 2007
    Posts
    205
    If you remove these lines, you won't get an error any more!
    They don't seem to be defined...or needed!

    HTML Code:
    // This defines the source of the preview image 
    document.images['pimage1'].src=image1.src;
    document.images['pimage2'].src=image2.src;
    document.images['pimage3'].src=image3.src;
    document.images['pimage4'].src=image4.src;
    document.images['pimage5'].src=image5.src;
    document.images['pimage6'].src=image6.src;

  6. #6
    Join Date
    Sep 2007
    Location
    Brisbane, Australia
    Posts
    3
    Thanks Guys, very much appreciated

    Worked a treat.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles