This assignment asks you to alter Figure 9-11 so that mousing over the image stops the slide show, and mousing off the image starts it again. The solution is very much like Figure 9-11. The only addition is the link around the image that clears the time-out when it is moused over and restarts the slideshow when the mouse moves off of it.

<html> <head> <title>Chapter 9 Assignment</title> <script type = "text/javascript"> <!-- hide me from older browsers // preload the images var the_images = new Array(); the_images[0] = new Image(); the_images[0].src = "one.jpg"; the_images[1] = new Image(); the_images[1].src = "two.jpg"; the_images[2] = new Image(); the_images[2].src = "three.jpg"; var the_timeout; var index = 0; // function rotateImage() ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.