Hey i need help on the eval loop. Im trying to do a 3 image rotation and i would like to use 1 function for 3 images...I have been trying to figure out how to do it but it wont works. would anyone please help me out? Below is my code:
<script language="JavaScript">
<!-- begin
//initialize variable and set the rotating image speed
imageNum = 0;
imageNum1 = 0;
RotateSpeed = 2000;
//the images for first tile on the the SiteStore ads
images = new Array();
images[0] = new Image();
images[0].src = "image1.gif";
images[1] = new Image();
images[1].src = "image2.gif";
images[2] = new Image();
images[2].src = "image3.gif";
//this is to identify the URLs for the first tile
url = new Array();
url[0] = "";
url[1] = "";
url[2] = "";
//the images for second tile on the the SiteStore ads
images = new Array();
images[0] = new Image();
images[0].src = "image1.gif";
images[1] = new Image();
images[1].src = "image2.gif";
images[2] = new Image();
images[2].src = "image3.gif";
//this is to identify the URLs for the second tile
url = new Array();
url[0] = "";
url[1] = "";
url[2] = "";
//the images for third tile on the the SiteStore ads
images = new Array();
images[0] = new Image();
images[0].src = "image1.gif";
images[1] = new Image();
images[1].src = "image2.gif";
images[2] = new Image();
images[2].src = "image3.gif";
//this is the URLs for the third tile
url = new Array();
url[0] = "";
url[1] = "";
url[2] = "";
//this function is to rotate the image where
//the images start randomly but in an order
function RotateImage(images) {
if (imageNum < images.length - 1) imageNum++;
else
imageNum = 0;
Name = images[imageNum].src;
setTimeout('RotateImage(images)', RotateSpeed);
}
//this function is to set the image to rotate randomly
function RandomImage(images) {
imageNum=Math.floor(Math.random(images)*images.length)
Name = images[imageNum].src;
setTimeout('RotateImage(images)', RotateSpeed);
}
function gotoLink() {
window.location.href = url[imageNum];
}
//end hide me -->
</script>