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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.