• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Part: III Document Object Model for HTML... > DOM-2 Events and Event Handlers

Chapter 32. DOM-2 Events and Event Handlers

From Chapter 21 on, you've been noticing lists of event handlers each element supports. Event handlers in JavaScript are primarily about doing something before the normal reactions to a user's actions take place. For instance, we frequently use a form onsubmit event handler for validation of the form on the client. Chapter 30, “Image Elements,” featured two event-driven animations (Listings 30.1 and 30.2) with the mouse over a certain image location. In Chapter 15, “window,” I covered frames and the impact of the onload event handler.

So what is an event, anyway? In JavaScript terms, an event is an object created and passed around like a hot potato to various other objects in the document when something happens. Event handlers are optional slots in each element for functions that react to specific types of events.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint