HTML and CSS Reference
EXPLANATION ( CONTINUED )
The src property of the image object is assigned a new picture. By using the name
image object to use. (Another way to get to the image: document.planet_pic.src or
Once the index value exceeds the length of the array, the index value, i , is reset to
0 and the slideshow begins again.
The timer is set so that once every 1.5 seconds a new picture is displayed.
When the user clicks the button labeled “Stop Show,” the clearTimeout() function
is called, causing the timer to stop. The argument, timeout , is a reference to the
timer set on line 8.
The initial image is a picture of the planet Jupiter (see Figure 12.22). It is given
size dimensions, which will determine the size of all images in the slideshow. If
the images are of different dimensions, they will have to be scaled to this size. Not
properly sizing images will give them a distorted appearance.
Figure 12.22 Planet slideshow with two control buttons.
In Example 12.11 a set of planet images is displayed as a slideshow. If the viewer clicks
one of the planets, he or she is redirected to a Web page that describes that planet. This