Handling events with the DOM - Part III - Another creature in an object-based world: the Event object (Page 2 of 7 )
In the case of event handlers, the Event object of the DOM is the logical medium through we are able to manipulate user or system-generated events. Whether we’re clicking on a link or moving the mouse around, the object processes this information, making it available for further manipulation in Web documents.
The first browser incompatibility that we must face is the fact that IE doesn’t support the W3C Event Model. Instead of exposing an Event object to be passed to a handler function, it provides a global object named "window.event" that makes available some properties functionally similar to those present in the W3C Standard. On the other hand, Netscape and Mozilla do support the Event object pretty well.
Either we’re referencing the standards or proprietary models, but as soon as we need to read event data, we’re pretty overwhelmed with lots of properties, most of which don’t work in most popular browsers. There is such abundant information and specifications for each property and method implemented, that many Web developers end up getting confused about them, without putting their skills to use in practical and real-world situations. For this certainly valid reason, we’ll be focusing our attention on the most common event-related tasks that developers must face on a regular basis, in order to obtain fast and effective results.
Our first logical step consists of detecting the type of event generated. Let’s see how this can be done.