Random image script
I am designing a site for a friend and he wants the homepage to have an different image (out of say 5) appear when the site is loaded. This might sound confusing... but he does not want an image rotator, he simply wants a different one of the 5 pics to appear when the site is loaded.
Thanks in advance.
var rootPath = "/images/homepage/"; // Or wherever
var arrImages = ('pic1.jpg','pic2.jpg','pic3.jpg','pic4.jpg','pic5.jpg');
var rand = Math.floor(Math.random() * arrImages.length);
document.write('<img src="' + rootPath +''+ arrImages[rand] + '" />');