ChapterÂ 6.Â Catching Events
Events let you know when a user is doing something or when a page has loaded. Catching and handling events lets your code do the right thing at the right time, serving the users of your programs.
The events themselves are fairly intuitive. The W3C (World Wide Web Consortium) categorizes events into three distinct areas: user interface (mouse, keyboard), logical (result of a process), and mutation (action that modifies a document). The basic events, affected objects, and descriptions are listed in Table 6-1.
TableÂ 6-1.Â Events and affected objects
||When image is prevented from loading||An image element|
|When object loses or receives focus||Applicable to window and form elements|
||When selection changes||Applicable to form elements where value changes and after element loses focus|
|Clicking or double clicking (two clicks in rapid succession) with mouse||Most page elements|