Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript random img on page load Re: random img on page load

#54253

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];
}