August 1999
Intermediate to advanced
1488 pages
72h 53m
English
event.target
The target property of the Event object refers to the object on which the event takes place.
Listing 7.213 shows an example of how the target property can be used to determine to which object an event occurred. In the HTML document, there are three buttons. When the button is clicked, a JavaScript function catches the click event and, using the target property, tells the user which button was clicked.
<html> <head> <title>Using the target property of the event object</title> </head> <body> <script language = "JavaScript"> <!--Hide // informs the user which mouse button was pressed function whichButton(evnt){ window.captureEvents(evnt.CLICK); ... |
Read now
Unlock full access