The Internet Explorer Event Model: The Event Object's Properties - Doc JavaScript | WebReference

The Internet Explorer Event Model: The Event Object's Properties - Doc JavaScript


The Event Object's Properties

As you already know, the event object's properties hold additional information about the event that occurred. Although all event properties are available to all event objects, some properties don't have any meaning for various events. In other words, not all of the properties are relevant to each type of event. The following table lists the properties of the event (window.event) object in Internet Explorer 4.0x:

PropertyDescription
srcElementA reference of the object for which the event is intended (the element that initiated the event).
typeA read-only string representing the event type (e.g., "click").
clientXA number specifying the horizontal coordinate of the mouse cursor at the time of event, with respect to the target object's page (the browser window).
clientYA number specifying the vertical coordinate of the mouse cursor at the time of event, with respect to the target object's page (the browser window).
screenXA number specifying the horizontal coordinate of the mouse cursor at the time of event, with respect to the client's screen.
screenYA number specifying the vertical coordinate of the mouse cursor at the time of event, with respect to the client's screen.
offsetXA number specifying the horizontal coordinate of the mouse cursor at the time of event, with respect to the container element. It matches the offsetLeft property of the element. Use the element's offsetParent property to find the container element that defines this coordinate system. This is a read-only property.
offsetYA number specifying the vertical coordinate of the mouse cursor at the time of event, with respect to the container element. It matches the offsetTop property of the element. Use the element's offsetParent property to find the container element that defines this coordinate system. This is a read-only property.
xA number specifying the horizontal coordinate of the mouse cursor at the time of event, with respect to the element in the parent hierarchy that is positioned using the CSS positioning attribute. If no element has been positioned, the BODY element is the default. If the mouse is outside the window when the event is called, this property returns -1. This is a read-only property.
yA number specifying the vertical coordinate of the mouse cursor at the time of event, with respect to the element in the parent hierarchy that is positioned using the CSS positioning attribute. If no element has been positioned, the BODY element is the default. If the mouse is outside the window when the event is called, this property returns -1. This property has read-only permission
buttonA number specifying the mouse button that was pressed. The primary mouse button is a value of 0. In practice the browsers don't let you trap for this user event. Right clicks in Windows 95 or NT, for example, display a context-sensitive pop-up menu, without passing the event to the page. It is intended to be used with the onmousedown, onmouseup, and onmousemove events. The middle button sets this property to 0 on some systems, so do not rely on it.
keyCodeA number specifying the Unicode key code associated with the key that caused the event. This property is intended to be used with the keydown, keyup, and keypress events. For other events, this property is set to 0 (zero). Note that this is a read-write property, meaning that an event handler can assign it a new value, overwriting the original one.
altKey
ctrlKey
shiftKey
A Boolean value specifying whether the corresponding key (Alt, Ctrl, Shift) is pressed. These properties specify whether the Alt, Ctrl, and Shift keys were down or up at the time of the event. The property is true is the key was down.
cancelBubbleA Boolean value specifying whether the current event should bubble up the hierarchy of event handlers. We discussed this property in depth earlier in the column.
returnValueA Boolean value specifying the return value from the event handler. Setting it to false cancels the default action of the source element of the event. We discussed this property in depth earlier in the column.
reasonA number specifying the disposition of data transfer for a data source object. This read-only property indicated the reason for completion. It is 0 if the data is transmitted successfully , 1 if the data transfer was aborted, and 2 if the data was transferred in error.
srcFilterA reference of the filter object that caused the filterchange event to fire. This is a read-only property.
fromElementA reference of the element is the mouse is moving from, during a mouseover or mouseout event. This is a read-only property.
toElementA reference of the element is the mouse is moving to, during a mouseover or mouseout event. This is a read-only property.

https://www.internet.com


Created: December 30, 1997
Revised: January 11, 1997

URL: https://www.webreference.com/js/column10/eventobjectproperties.html