Randomise Thumbnails

  ikle_pixie 22:38 09 Apr 2005

On the home page of my website i have 5 thumbnails which lead you to different sections of the site. I would like to have those thumbnails change each time the page is refreshed.

Does anyone have an ideas how?


click here

  Charence 02:23 10 Apr 2005

Here's some code :o)





<!-- Begin

var a = Math.random() + ""

var rand1 = a.charAt(5)

images = new Array

images[1] = "CharenceName3DUK1"

images[2] = "CharenceName3DUK2"

images[3] = "CharenceName3DUK3"

images[4] = "CharenceName3DUK4"

images[5] = "CharenceName3DUK5"

images[6] = "CharenceName3DUK6"

images[7] = "CharenceName3DUK1"

images[8] = "CharenceName3DUK2"

images[9] = "CharenceName3DUK3"

images[0] = "CharenceName3DUK0"

var image = images[rand1]

document.write("<img src=" + image + ".jpg>");

// End -->





Currently the code above can have 10 random images, this may be altered. Also where it says "CharenceNameUK3D" is the filename of the image.

click here for working example.


  ikle_pixie 02:26 10 Apr 2005

yay! thank you...

will give it a go

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

iMac Pro review

Illustrator Charles Williams on how to create magazines and book covers

iMac Pro review

Les meilleures prises CPL (2018)