return to homepage

Scripts: Javascript

Random Image Display

I wrote this script to display a random image for my photo gallery homepage (gallery) and then used it to randomly select the image that is displayed at the top of this page:

Open random image example

 

<SCRIPT LANGUAGE="JavaScript">
<!--

//// Generates a randon number between 0 and 8
ranNum = Math.round(Math.random()*8);

document.write('<IMG SRC="'+ranNum+'image.jpg" ALT="Filename: '+ranNum+'image.jpg" STYLE="BORDER: 1px solid #000000"&rt;
Filename: '+ranNum+'image.jpg');

//-->
</SCRIPT>