toast
Gone !
This my actual code: do you see any problems ? Any improvements to make ?
Code:
// Random picture<br>
var ic = 10; // Number of alternative images<br>
var table = new Array(ic); // Array to hold filenames<br>
<br>
table[0] = "images/photo1.jpg";
table[1] = "images/photo2.jpg";
table[2] = "images/photo3.jpg";
table[3] = "images/photo4.jpg";
table[4] = "images/photo5.jpg";
table[5] = "images/photo6.jpg";
table[6] = "images/photo7.jpg";
table[7] = "images/photo8.jpg";
table[8] = "images/photo9.jpg";
table[9] = "images/photo10.jpg";
function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
var choice = pickRandom(ic); // Write out IMG tag using a randomly-chosen image name.