Return to Snippet

Revision: 27842
at June 25, 2010 01:31 by d55beck


Updated Code
<script type="text/javascript">
  var randomnumber = Math.floor(Math.random()*4)+1; // Start at 1 instead of 0 
  document.write('<img src="imagePrefix_' + randomnumber + '.jpg" />');
</script>

Revision: 27841
at June 25, 2010 01:16 by d55beck


Initial Code
<script type="text/javascript">
  var randomnumber = Math.floor(Math.random()*4); 
  document.write('<img src="imagePrefix_' + randomnumber + '.jpg" />');
</script>

Initial URL

                                

Initial Description
Extremely simple random image when using similar naming structure and a set number of images (eg. imagePrefix_1,jpg, imagePrefix_2,jpg, etc.)

Initial Title
Very Simple Random Image

Initial Tags
javascript, simple

Initial Language
JavaScript