Welcome to WebmasterWorld Guest from 54.166.46.226

Forum Moderators: open

Message Too Old, No Replies

Rotating JavaScript Image Suggestion

   
3:36 am on Mar 28, 2003 (gmt 0)

10+ Year Member



I am looking for a JavaScript that will load a different image on a new page view. In other words, I would like to have a static image, that changes upon reloads. Does anyone know if this is possible without using cookies?

Any suggestions are much appreciated as well as URLS where I may find such code.

5:35 am on Mar 28, 2003 (gmt 0)

10+ Year Member



A simple random generator can be used for image rotation:

<script language="JavaScript">
var rand_int = Math.floor(Math.random()*4);
var photos = new Array(4)
photos[0] = '<img src="image1.gif">';
photos[1] = '<img src="image2.gif">';
photos[2] = '<img src="image3.gif">';
photos[3] = '<img src="image4.gif">';
document.write(photos[rand_int]);
</script>

T