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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Firebug finding error "myimages is not defined"

    I'm new to JavaScript and I'm using some code posted for free use. I altered to accommodate my layout. Everything is working fine except I'm getting an error in Firebug that says:

    "myimages is not defined" for the following line of code hilighted in red

    myimages[x] = new Image();

    All of the code can be viewed here: http://www.royaltin.com/MZ09/marla/archive.html

    How do I define this? The original code is no different and it doesn't return any errors.

    The original code: http://www.banksmedia.com/portfolio

    Any help is greatly appreciated.

  • #2
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    why exactly are you using "x" it just seems at though you would be rewriting the same variable over and over.

    also the place you got the script from originally has the exact same error

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts
    change myimages[x] to myimages[i]
    mybe then will work, didn't look into details

  • #4
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I tried changing myimages[x] to myimages[i] but it returns the same error. I'm not sure why the original code doesn't return the same error as nothing has changed.

    Being new to JavaScript, all I know is that this function is a preloader and it works fine with the code, doesn't work without the code but I'm not sure why it is returning an error.

    Ideas, anyone??

  • #5
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Try adding this piece of code at the beginning of the script:
    var myimages = [];

  • Users who have thanked BarrMan for this post:

    amamfda (01-27-2009)

  • #6
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up resolved

    BarrMan, this worked perfectly. No more errors!

    Thank you for your help!


  •  

    Posting Permissions

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