September 2015
Intermediate to advanced
92 pages
1h 30m
English
CHAPTER 11
![]()
Events
Events are occurrences that take place in the interaction between the user, the web page, and the browser. Event handling enables a script to detect and react to these occurrences, allowing the web page to become interactive.
Event Handling
There are three steps to handling an event. First, you need to locate the element that will receive the event. Events always take place in the context of element nodes inside the DOM tree. In this example the event will occur when the following hyperlink is clicked.
<a href="http://www.google.com" id="mylink">My link</a>
The next step is to create an event handler, which is the code that will ...
Read now
Unlock full access