DHTML Event Model
DHTML Event Model
Event Model
Outline
14.1 Introduction
14.2 Event onclick
14.3 Event onload
14.4 Error Handling with onerror
14.5 Tracking the Mouse with Event onmousemove
14.6 Rollovers with onmouseover and onmouseout
14.7 Form Processing with onfocus and onblur
14.8 More Form Processing with onsubmit and onreset
14.9 Event Bubbling
14.10 More DHTML Events
14.11 Web Resources
• onload event
– Fires when an element finishes loading
– Used in the body element
– Initiates a script after the page loads into the client
• onerror event
– Execute specialized error-handling code
button Returns which mouse button was pressed by user (1: left-mouse button, 2:
right-mouse button, 3: left and right buttons, 4: middle button, 5: left and
middle buttons, 6: right and middle buttons, 7: all three buttons).
cancelBubble Set to false to prevent this event from bubbling (see Section 14.9, “Event
Bubbling”).
clientX / clientY The coordinates of the mouse cursor inside the client area (i.e., the active
area where the Web page is displayed, excluding scrollbars, navigation
buttons, etc.).
ctrlKey This value is true if Ctrl key was pressed when event fired.
offsetX / offsetY The coordinates of the mouse cursor relative to the object that fired the event.