TIA
Google for javascript random. This was not written by me, but was posted by Joe Greene some time ago in a different news group. /* Try this. I wrote a function to generate a random number: */ function Roll_Die(DSize){ var DRoll=0; for (I=0;I<DSize;I++){ DRoll+=Math.round(Math.random()); } return DRoll } /* Now Given the use of the above function, create an array of image filenames */ var MyImages=new Array(); MyImages[0]="foo.gif"; MyImages[1]="bar.jpg"; MyImages[2]="foo-bar.gif"; /* Next assuming you are manipulating the first image on your page call this function to randomly change pictures. */ function RandomPix(){ var P=Roll_Die(MyImages.length); document.images[0].src="http://my.server.com/my/imge/folder/"+MyImages[P]; } /* You can call the function in onLoad= to only select at load time, or you can create another function with a setInterval() calling itself to randomly change images periodically. Note: if your going to change images at intervals it's recommened to create a hidden layer which loads them all, in order to minimize the lage when it changes pictures.... */
Google for javascript random. The problem with a randomizer like this is that it must be hard-coded with the names of the images, and it increases the size of the HTML file (significantly, if there are many images). I have written a Perl random image CGI which allows you to dump images into a folder on the server, and grabs one of the images from that folder at random; in order to use it, you must (of course) have a Web host which permits you to use CGI scripts. It's freeware, and available for download from my Web site at www.xeromag.com/fvshare.html