HTML and CSS Reference
In-Depth Information
EXPLANATION
(
CONTINUED
)
12
The
getElementsByTagName()
method returns a reference to the first
img
element
in the document and assigns the reference to
picture
.
13
The
getElementById()
method returns a reference to the
div
element that will hold
the caption for an image.
14
Every 5 seconds, an image replacement takes place by changing the value assigned
to the
src
attribute of the image.
15
Every 5 seconds, the timer will call the
startSlideShow()
function.
16
The
stopSlideShow()
function turns off the timer, allowing the user to stop the
slideshow at any time.
Figure 15.50
A sample of the slideshow thumbnails.
Although the code used in this topic has been written from scratch, beginning with the
very basic JavaScript, once you get going you might want to download some of the use-
ful and free unobtrusive JavaScript code found in libraries on the Web. See
http://Java-
Scriptlibraries.com/
for a list of libraries and their links, and for a description of the ten
most popular libraries, go to
http://www.ajaxline.com/10-most-popular-JavaScript-frame-
1. jQuery
2. Prototype