Handling Events
Events are actions that the user performs while visiting your page. Submitting a form and moving a mouse over an image are two examples of events.
JavaScript deals with events using commands called event handlers. An action by the user on the page triggers an event handler in your script. The 12 most common JavaScript event handlers are listed in Table 1.1. We deal with other, more advanced event handlers in Chapter 9.
Event | What it handles |
---|---|
onabort | The user aborted loading the page |
onblur | The user left the object |
onchange | The user changed the object |
onclick | The user clicked an object |
onerror | The script encountered an error |
onfocus | The user made an object active |
onload | The object finished loading |
onmouseover | The cursor ... |
Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.