Chapter 4: Working with Images

Displaying a Random Image

See it run: Displaying a Random Image

Script 4.18

This simple HTML creates the page for a random image.

Script 4.19

You can display random images on your page with this script, which use JavaScript's Math.random method to generate a random number.

Images:

lion.jpg
tiger.jpg
bear.jpg