Previous Example-|-Next Example-|-Return to Chapter Listing

Example 12.19:
The JavaScript 1.2 event Object

[This example works with Netscape Navigator 3 or Internet Explorer 3. It will not work with Internet Explorer 3.]

This example shows how the event object contains information about the event. When you click the link you'll see an alert telling you the mouse pointer position.

This is a basic onclick link. Click anywhere in this link and you'll see the mouse position in the alert box. Click anywhere in this link and you'll see the mouse position in the alert box. Click anywhere in this link and you'll see the mouse position in the alert box. Click anywhere in this link and you'll see the mouse position in the alert box.


In the BODY of the page we have this link: <A HREF="Javascript:void(null)" onclick="alert('You clicked at ' + event.x + ', ' + event.y)"> This is a basic onclick link. Click anywhere in this link and you'll see the mouse position in the alert box. Click anywhere in this link and you'll see the mouse position in the alert box. Click anywhere in this link and you'll see the mouse position in the alert box. Click anywhere in this link and you'll see the mouse position in the alert box.</A>
Previous Example-|-Next Example-|-Return to Chapter Listing