If you want to do this client-side then you just need to use the Math.random method which returns a "random" number between 0 and 0.999...
So if you have five images:
Code:
function getRandomInteger(To)
{
return Math.round(Math.random() * To));
}
function setBannerImage(Index)
{
var colImages = ["bannerImage1.gif",
"bannerImage2.gif",
"bannerImage3.gif",
"bannerImage4.gif",
"bannerImage5.gif"];
document.getElementById("imgBanner").src = colImages[Index];
}
Then in your HTML give the banner image an id of "imgBanner" and as the page loads call:
Code:
setBannerImage(getImageIndex(4));
--
Joe (
Microsoft MVP - XML)