|
 |
|
|
09-27-2009, 11:49 AM
|
ImgArr2 is undefined
|
Posts: 254
Name: Daniel Mousdell
|
Hey,
Recently I found out that my website seems to show a javascript warning in Internet Explorer - http://www.lilwaynehq.com - You can see the message in the screenshot below:
I know that it has something to do with my logo code (which I use to swap images every few seconds):
Code:
script language="JavaScript">
var ImageArr1 = new Array("http://www.lilwaynehq.com/images/lilwaynehqlogo-800-big.jpg","http://www.lilwaynehq.com/images/lilwaynehqlogo2-800-big.jpg");
var ImageHolder1 = document.getElementById('Rotating1');
function RotateImages(whichHolder,Start)
{
var a = eval("ImageArr"+whichHolder);
var b = eval("ImageHolder"+whichHolder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+")",6500);
}
RotateImages(1,0);
RotateImages(2,0);
</script>
Does anyone know how I can fix this?
Thanks, apperciate it 
Last edited by Danaldinho; 09-27-2009 at 11:51 AM..
|
|
|
|
09-27-2009, 03:08 PM
|
Re: ImgArr2 is undefined
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
When I see this:
and I look into the RotateImages function, I see that
the array it uses is based on the first parameter:
Code:
function RotateImages(whichHolder,Start)
{
var a = eval("ImageArr"+whichHolder);
var b = eval("ImageHolder"+whichHolder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+")",6500);
}
So, by calling "RotateImages(2,0)", you must have an ImageArr2 array and an ImageHolder2 element already defined with the images you want.
Otherwise, if you want 2 times the same image rotation, but in different placeholders, you will need to do something like
Code:
var ImageArr1 = ImageArr2
= new Array("http://www.lilwaynehq.com/images/lilwaynehqlogo-800-big.jpg","http://www.lilwaynehq.com/images/lilwaynehqlogo2-800-big.jpg");
var ImageHolder1 = document.getElementById('Rotating1');
var ImageHolder2 = document.getElementById('Rotating2');
This will make the images arrays ImageArr1 and ImageArr2 identical, but give a specific placeholder for both.
__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
09-27-2009, 03:31 PM
|
Re: ImgArr2 is undefined
|
Posts: 254
Name: Daniel Mousdell
|
Quote:
Originally Posted by tripy
When I see this:
and I look into the RotateImages function, I see that
the array it uses is based on the first parameter:
Code:
function RotateImages(whichHolder,Start)
{
var a = eval("ImageArr"+whichHolder);
var b = eval("ImageHolder"+whichHolder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+")",6500);
}
So, by calling "RotateImages(2,0)", you must have an ImageArr2 array and an ImageHolder2 element already defined with the images you want.
Otherwise, if you want 2 times the same image rotation, but in different placeholders, you will need to do something like
Code:
var ImageArr1 = ImageArr2
= new Array("http://www.lilwaynehq.com/images/lilwaynehqlogo-800-big.jpg","http://www.lilwaynehq.com/images/lilwaynehqlogo2-800-big.jpg");
var ImageHolder1 = document.getElementById('Rotating1');
var ImageHolder2 = document.getElementById('Rotating2');
This will make the images arrays ImageArr1 and ImageArr2 identical, but give a specific placeholder for both.
|
Sorry, I didn't quite understand you there.
Should I basically do:
Or what you said about the 2 ImageHolders?
Thanks 
|
|
|
|
09-27-2009, 03:44 PM
|
Re: ImgArr2 is undefined
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
What I say is that "RotateImages(1,0);" uses the images defined in
ImageArr1 to place them in the placeholder ImageHolder1.
If you use "RotateImages(2,0);", then you must have ImageArr2 and ImageHolder2 defined.
If you call "RotateImages(3,0);", then you will need ImageArr3 and ImageHolder3.
And so on.
If you want 2 rotators with the same images, you must define 2 arrays of images with the same content, and give different placeholders.
__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
09-27-2009, 05:11 PM
|
Re: ImgArr2 is undefined
|
Posts: 254
Name: Daniel Mousdell
|
Thanks very much, that seemed to work.
But the bad news is that there is now another error:
Code:
<script language="JavaScript">
var ImageArr1 = ImageArr2
= new Array("http://www.lilwaynehq.com/images/lilwaynehqlogo-800-big.jpg","http://www.lilwaynehq.com/images/lilwaynehqlogo2-800-big.jpg");
var ImageHolder1 = document.getElementById('Rotating1');
var ImageHolder2 = document.getElementById('Rotating2');
function RotateImages(whichHolder,Start)
{
var a = eval("ImageArr"+whichHolder);
var b = eval("ImageHolder"+whichHolder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+")",6500);
}
RotateImages(1,0);
RotateImages(2,0);
</script>
Do you know what this could be?
Thanks 
|
|
|
|
09-27-2009, 05:54 PM
|
Re: ImgArr2 is undefined
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Nope, don't know, and running no windows boxes, I don't have a IE to test.
Sorry.
__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
09-27-2009, 06:20 PM
|
Re: ImgArr2 is undefined
|
Posts: 254
Name: Daniel Mousdell
|
Oh okay then.
Does anyone else have any ideas how to fix this?
Thanks 
|
|
|
|
10-01-2009, 07:56 AM
|
Re: ImgArr2 is undefined
|
Posts: 254
Name: Daniel Mousdell
|
Quote:
Originally Posted by Danaldinho
Thanks very much, that seemed to work.
But the bad news is that there is now another error:
Code:
<script language="JavaScript">
var ImageArr1 = ImageArr2
= new Array("http://www.lilwaynehq.com/images/lilwaynehqlogo-800-big.jpg","http://www.lilwaynehq.com/images/lilwaynehqlogo2-800-big.jpg");
var ImageHolder1 = document.getElementById('Rotating1');
var ImageHolder2 = document.getElementById('Rotating2');
function RotateImages(whichHolder,Start)
{
var a = eval("ImageArr"+whichHolder);
var b = eval("ImageHolder"+whichHolder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+")",6500);
}
RotateImages(1,0);
RotateImages(2,0);
</script>
Do you know what this could be?
Thanks 
|
Anyone got any ideas?
Thanks
|
|
|
|
|
« Reply to ImgArr2 is undefined
|
|
|
| Thread Tools |
Search 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
HTML code is Off
|
|
|
|