Home › Forums › JavaScript › random img on page load › Re: random img on page load
February 23, 2009 at 7:06 pm
#54253
davesgonebananas
Member
I also agree that PHP is by far the best way to solve this problem. But supposing your host doesn’t provide PHP then you might want to try changing your randomImage function as follows:
Code:
function randomImage() {
var i = Math.floor(Math.random()*images.length);
document.getElementById(“random”).src=”Raw Images/” + images[i];
}
var i = Math.floor(Math.random()*images.length);
document.getElementById(“random”).src=”Raw Images/” + images[i];
}