Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2009, 01:18 AM   PM User | #1
amamfda
New to the CF scene

 
Join Date: Jan 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
amamfda is an unknown quantity at this point
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.
amamfda is offline   Reply With Quote
Old 01-27-2009, 03:25 AM   PM User | #2
ninnypants
Regular Coder

 
ninnypants's Avatar
 
Join Date: Apr 2008
Location: Utah
Posts: 504
Thanks: 10
Thanked 47 Times in 47 Posts
ninnypants is an unknown quantity at this point
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
ninnypants is offline   Reply With Quote
Old 01-27-2009, 03:32 AM   PM User | #3
BubikolRamios
Senior Coder

 
Join Date: Dec 2005
Location: Slovenia
Posts: 1,876
Thanks: 114
Thanked 76 Times in 76 Posts
BubikolRamios is on a distinguished road
change myimages[x] to myimages[i]
mybe then will work, didn't look into details
BubikolRamios is offline   Reply With Quote
Old 01-27-2009, 05:45 PM   PM User | #4
amamfda
New to the CF scene

 
Join Date: Jan 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
amamfda is an unknown quantity at this point
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??
amamfda is offline   Reply With Quote
Old 01-27-2009, 06:48 PM   PM User | #5
BarrMan
Senior Coder

 
BarrMan's Avatar
 
Join Date: Feb 2005
Location: Israel.
Posts: 1,644
Thanks: 69
Thanked 83 Times in 82 Posts
BarrMan is on a distinguished road
Try adding this piece of code at the beginning of the script:
var myimages = [];
BarrMan is offline   Reply With Quote
Users who have thanked BarrMan for this post:
amamfda (01-27-2009)
Old 01-27-2009, 07:23 PM   PM User | #6
amamfda
New to the CF scene

 
Join Date: Jan 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
amamfda is an unknown quantity at this point
Thumbs up resolved

BarrMan, this worked perfectly. No more errors!

Thank you for your help!
amamfda is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:19 AM.


Advertisement
Log in to turn off these ads.