View Full Version : Firebug finding error "myimages is not defined"

01-27-2009, 01:18 AM
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.

01-27-2009, 03:25 AM
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

01-27-2009, 03:32 AM
change myimages[x] to myimages[i]
mybe then will work, didn't look into details

01-27-2009, 05:45 PM
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??

01-27-2009, 06:48 PM
Try adding this piece of code at the beginning of the script:
var myimages = [];

01-27-2009, 07:23 PM
BarrMan, this worked perfectly. No more errors!

Thank you for your help!