Chapter 9. Managing Events
Without events, there would be no Dynamic HTML. A strong statement, perhaps, but given the kinds of document object models we have inherited, it’s true. For any dynamism to occur in an HTML page, some kind of trigger is needed.
Two categories of triggers are available: user-generated actions and system-generated actions. Direct user-generated actions are those caused by mouse and keyboard activity. System-generated actions , perhaps more accurately described as document- or browser-generated actions, occur when something significant occurs in the browser, such as the document completing its loading into the browser or an image failing to retrieve its data from the server.
One of your jobs as a DHTML scripter is to determine which events on
which elements should trigger scripted actions. Any kind of form
button, for example, will usually have some script action associated
with it (unless it is just the default actions of submit and reset
input element types). Less obvious, perhaps, are events that inspect
the characters being typed into a text box, to make sure only allowed
characters are permitted to pass. Very common mouse-oriented events
detect when the cursor rolls atop an image element (or an
a hyperlink element surrounding the image) so that
a script can change the image to a highlighted version during this
“rollover.” A corresponding event
for when the cursor rolls off the image reverts the image back to its