![]() |
Miguel A. Almarza
|
|||||
|
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:
Property | Description |
srcElement |
A reference of the object for which the event is intended (the element that initiated the event). |
type |
A read-only string representing the event type (e.g., "click" ). |
clientX |
A 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). |
clientY |
A 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). |
screenX |
A number specifying the horizontal coordinate of the mouse cursor at the time of event, with respect to the client's screen. |
screenY |
A number specifying the vertical coordinate of the mouse cursor at the time of event, with respect to the client's screen. |
offsetX |
A 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. |
offsetY |
A 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. |
x |
A 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. |
y |
A 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 |
button |
A 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. |
keyCode |
A 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 |
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. |
cancelBubble |
A 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. |
returnValue |
A 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. |
reason |
A 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. |
srcFilter |
A reference of the filter object that caused the filterchange
event to fire. This is a read-only property. |
fromElement |
A reference of the element is the mouse is moving from, during
a mouseover or mouseout
event. This is a read-only property. |
toElement |
A reference of the element is the mouse is moving to, during a
mouseover or mouseout
event. This is a read-only property. |