Randomly Generated Images
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse egestas ultricies pede. Phasellus suscipit blandit risus. Praesent nonummy. In erat. Duis nibh pede, accumsan eu, pulvinar et, volutpat vel, elit. Curabitur nec dui sed nunc congue tempus. Nulla ac dui ac libero fringilla nonummy. Maecenas ullamcorper sodales risus. Vivamus pretium dolor. Proin eu turpis. Phasellus ut mauris non nulla mattis luctus. Nunc porttitor dapibus sapien. In malesuada fermentum metus. Nulla egestas, tellus a vestibulum pharetra, nunc purus auctor lacus, ut semper purus ipsum eu velit. Praesent dui. Nulla accumsan turpis at erat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse egestas ultricies pede. Phasellus suscipit blandit risus. Praesent nonummy. In erat. Duis nibh pede, accumsan eu, pulvinar et, volutpat vel, elit. Curabitur nec dui sed nunc congue tempus. Nulla ac dui ac libero fringilla nonummy. Maecenas ullamcorper sodales risus. Vivamus pretium dolor. Proin eu turpis. Phasellus ut mauris non nulla mattis luctus. Nunc porttitor dapibus sapien. In malesuada fermentum metus. Nulla egestas, tellus a vestibulum pharetra, nunc purus auctor lacus, ut semper purus ipsum eu velit. Praesent dui. Nulla accumsan turpis at erat.
1) | Create the image array | var imgArray1 = new Array(image 1, ...image 99, ) | |
2) | Count the elements in the image array | var max = imgArray1.length; | |
3) | Create a variable based on the low integer return of a randomly generated number from 0 to the maximum value of the max variable. | var num = Math.floor((Math.random() * max)); | |
4) | Start writting the image tag with the source assigned to the image array element that was generated by the randomly generated number. | document.write('<img src="' + imgArray1 [num] ); | |
5) | Finish writting the image tag with any attributes or style needed to complete the tag. |
document.write('" width="178px" border=2 '); document.write(' style="position:relative; float:left; margin:30px;" >'); |