var currentdate = 0;
var image_number = 0;
function ImageArray (n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ' '
}
}
image = new ImageArray(3)
image[0] = 'image1.gif'
image[1] = 'image2.gif'
image[2] = 'image3.gif'
var rand = 60/image.length
function randomimage() {
currentdate = new Date()
image_number = currentdate.getSeconds()
image_number = Math.floor(image_number/rand)
return(image[image_number])
}
document.write("
To Substitute Your Own Images
Change the imlocation variable to show the correct location of your images.
Swap the file names in the ImageArray() for your own.
To use a different number of images, add each new image on a line of its own, following the same format. You also need to change the number in the ImageArray() to reflect the total number of images (remember to count the "zero"). For example:
image = new ImageArray(5)
image[0] = 'image1.gif'
image[1] = 'image2.gif'
image[2] = 'image3.gif'
image[3] = 'image4.gif'
image[4] = 'image5.gif'

0 comments:
Post a Comment