Window.event (Property)

During event handling, MSIE stores a reference to an event object in this variable.

Availability:

JScript - 3.0
Internet Explorer - 4.0
Property/method value type:Event object
JavaScript syntax:IEevent
IEmyWindow.event

In MSIE, this property yields a reference to an event object. This only has any meaning during an event handler call and it is shared by all events which you would assume will cause some problems when multiple events are triggered. However, it seems to sort itself out most of the time. You will most likely refer to the event property as a member of the Global object, omitting the window prefix. The handler can acquire the object if it needs it to find out more about the context of the event.

In Netscape Navigator prior to version 6.0, the event object is passed as an argument to the event handler function. Netscape 6.0 implements the DOM level 2 event model which works like the MSIE technique.

This means your event handlers must be written slightly differently if they need to access an event object that pertains to the event itself.

To get a roughly portable handler together, the MSIE event can be stored in a local variable. Then, as it turns out, it is easier to convert the old style Netscape Navigator properties to MSIE compatible properties. You may not need to convert all of them and you may need to do some experimentation to see that the bit-masking of modifier keys is correctly set up for your target browser.

The Closure() object technique applies here when assigning function objects be to be event handlers although that is not supported by MSIE version 4.

This entire event managing complex is under review and some work on standardization happens at DOM level 2 with more to come in DOM level 3. We may have to experience several more browser revisions before we can rely on a truly portable approach and that won't solve legacy browser issues until everyone has upgraded.

Warnings:

Property attributes:

ReadOnly.