MyFishTankNet
Aug 8th 2006, 5:00 pm
var bannerImages = new Array();
var bannerLinks = new Array();
var bannerText = new Array();
bannerLinks[0] = "image0-url-goes-here.html";
bannerImages[0] = "image0-picture-path-goes-here.jpg";
bannerText[0] = "description goes here";
bannerLinks[1] = "image1-url-goes-here.html";
bannerImages[1] = "image1-picture-path-goes-here.jpg";
bannerText[1] = "description goes here";
bannerLinks[2] = "image2-url-goes-here.html";
bannerImages[2] = "image2-picture-path-goes-here.jpg";
bannerText[2] = "description goes here";
var now = new Date();
var x = now.getSeconds() % bannerImages.length;
var numberOfBanners = 9;
for (i=0; i<numberOfBanners; i++) {
document.write("<tr><Td align=center><a href=" + bannerLinks[x] + "><img src=" + bannerImages[x] + " border=0><br><B>" + bannerText[x] + "</b></a><br><Br></td></tr>");
if (x == bannerImages.length) {
x = 0;
} else {
x++;
}
}
so currently that script takes the 3 variables i set above and displays them in groups of 3 in sequence. this works fine as long as it goes (1-2-3) but once it goes to (2-3-4) the 4 is undefined.
recoding it so it displays 3 variables above randomly is out of my abilities so i was hoping someone here could help me out.
Thank you!
var bannerLinks = new Array();
var bannerText = new Array();
bannerLinks[0] = "image0-url-goes-here.html";
bannerImages[0] = "image0-picture-path-goes-here.jpg";
bannerText[0] = "description goes here";
bannerLinks[1] = "image1-url-goes-here.html";
bannerImages[1] = "image1-picture-path-goes-here.jpg";
bannerText[1] = "description goes here";
bannerLinks[2] = "image2-url-goes-here.html";
bannerImages[2] = "image2-picture-path-goes-here.jpg";
bannerText[2] = "description goes here";
var now = new Date();
var x = now.getSeconds() % bannerImages.length;
var numberOfBanners = 9;
for (i=0; i<numberOfBanners; i++) {
document.write("<tr><Td align=center><a href=" + bannerLinks[x] + "><img src=" + bannerImages[x] + " border=0><br><B>" + bannerText[x] + "</b></a><br><Br></td></tr>");
if (x == bannerImages.length) {
x = 0;
} else {
x++;
}
}
so currently that script takes the 3 variables i set above and displays them in groups of 3 in sequence. this works fine as long as it goes (1-2-3) but once it goes to (2-3-4) the 4 is undefined.
recoding it so it displays 3 variables above randomly is out of my abilities so i was hoping someone here could help me out.
Thank you!