14.6 Events and Event Handlers^545
Figure 14.11
Demonstration of
onmouseoverwith
mouseovertest.html
Figure 14.12
Demonstration of
onmouseoutwith
mouseovertest.html
Move the mouse pointer away from the link. As soon as the mouse pointer is no longer
on the link, the mouseout event occurs and the onmouseoutevent handler is triggered.
This displays the alert box, as shown in Figure 14.12.
You can combine event handlers in one hypertext link. This is the essence of the image
swapping technique. The onmouseoverevent handler changes the image to a new image
and the onmouseoutevent handler changes the image back to the original image. This
technique is beyond the scope of this chapter, but perhaps this demonstration sheds
some light on how image swapping is accomplished.
CHECKPOINT 14.2
- With respect to objects, describe the difference between a property and a method.
Feel free to use words like thing, action, description, attribute, and so on. - What is the difference between an event and an event handler?
- Where are event handlers placed in the XHTML document?