
Chapter 8 Web Site Design and Development 313
will be triggered by the onClick event linked to a button, then that pop-up win-
dow will appear whenever a visitor clicks on the link associated with that button.
The actions available vary among browser versions.
Events are messages generated by browsers indicating that a visitor to a
Web page has done something, such as moved the cursor over a link. When
this happens, the browser generates an onMouseOver event for that link; the
browser then checks whether it should call some JavaScript code in response
to the event (a SWAP IMAGE action, for example). One event can even trigger
several actions, such as a swap image and the appearance of a pop-up window
triggered by an onMouseOver event and then an onClick event.
technique Lesson 8.18: Using Behaviors for Graphical rollovers
You can use behaviors for a host of actions that make your Web pages more
interactive. Graphical rollovers, which are called SWAP IMAGE actions in the
BEHAVIORS panel, are among the most common. Rollovers provide visual feed
back to the user by swapping an image when the cursor rolls over it.
There are two ways to create rollovers in Dreamweaver. The rst is to use
the SWAP IMAGE behavior. The other is to go to INSERT > IMAGE OBJECTS >
ROLLOVER IMAGE. Both ways are effective, and are described below; choose
the one that you are most comfortable using. You can also set the rollover prop-
erties for HTML text links by going to MODIFY > PAGE PROPERTIES.
The simplest rollovers require you to create two graphics. One is the graphic
that will be rolled over. This is usually a navigation button or a graphic that trig-
gers the appearance of the other graphic. The second graphic is the replace-
ment image that displays when the mouse-over occurs. When a navigation bar
is involved, the second graphic usually contrasts visually with the rst graphic,
typically by graying out the graphic, changing colors, or adding a border.
Make sure that the rollover image is the same size as the image being
swapped; if the container (table cell or AP div) is too small to accommodate it,
the image will become distorted upon rollover.
QuiCk StePS (DW):
Using the Swap Image Behavior to Create Rollovers
You must have a rollover graphic ready before opening the BEHAVIORS panel
(see Technique Lesson 8.8, page 292). Make sure you have the image that will
be used in the rollover saved in the images folder of your Web site.
98364c08.indd 313 1/15/10 1:15:30 PM