Chapter 10

Event Handlers

Key Skills & Concepts

   Understanding Event Handler Locations and Uses

   Learning the Event Handlers

   Other Ways to Register Events

   The Event Object

   Creating Scripts Using Event Handlers

When creating scripts, you will often find that there are user “events” (such as a user moving a mouse over a certain element or clicking a particular element) to which you want your script to react. The way you do this is through the use of event handlers.

To learn how the event handlers work, you need to learn what they are and why they are useful to you. You will then learn where event handlers are placed in a document and how to use them. Finally, you will see the various events in JavaScript and the event handlers ...

Get JavaScript: A Beginner's Guide, Fifth Edition, 5th 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.