Getting Event Information

You might have noticed that I declared the function displayMessage as displayMessage(e) in the previous example. Why did I indicate that this function would be passed an argument? The answer is that it is passed an argument in the Netscape Navigator. This argument is an object of the event class, and you can get information about the event (such as where a mouse click occurred) using this object, which I've named e. You'll find the using this object, which I've named e. You'll find the properties of the event class in Netscape Navigator in Table 6-7.

However, Internet Explorer handles things differently, of course. In Internet Explorer, event-handling functions are not passed an event object. (JavaScript is flexible ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.