...

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



amamfda
01-27-2009, 02: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.

ninnypants
01-27-2009, 04: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

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

amamfda
01-27-2009, 06: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??

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

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

Thank you for your help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum