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

The Navigator Event Model: The Event Object's Properties - Doc JavaScript


The Event Object's Properties

Once you have access to the event object, you can take advantage of its properties, which hold additional information about the event that ocurred. Not every event has values assigned to every property of the event object (see the table on this page). In other words, not all of the properties are relevant to each type of event. Furthermore, some events utilize the properties differently, as dictated by the characteristics of the event. The following table lists the properties of the event object:

PropertyDescription
targetA reference of the object for which the event is intended. As opposed to Netscape's official documentation, this property is an object reference, not a string.
typeA string representing the event type (e.g., "click").
layerXA number specifying either the object width (the window's width) when passed with the resize event, or (for other events) the cursor's horizontal coordinate with respect to the layer in which the event occurred. Note that layerX is synonymous with x.
layerYA number specifying either the object height (the window's height) when passed with the resize event, or (for other events) the cursor's vertical coordinate with respect to the layer in which the event occurred. Note that layerY is synonymous with y.
widthA number specifying the width of the frame or window. When a resize event occurs, this property has the same value as layerX, but you should use it instead, because it is more intuitive.
heightA number specifying the height of the frame or window. When a resize event occurs, this property has the same value as layerY, but you should prefer it, because it makes more sense.
pageXA number specifying the horizontal coordinate of the mouse cursor at the time of event, with respect to the target object's page.
pageYA number specifying the vertical coordinate of the mouse cursor at the time of event, with respect to the target object's page.
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.
dataAn array of strings containing the URLs of dropped objects. We'll discuss this property later in the column when we talk about the dragdrop event, which is the only one to which this property applies.
whichA number specifying the mouse button that was pressed (for events that are associated with mouse clicks) or the ASCII value of a pressed key (for events that are associated with key presses). For the mouse, 1 is the left button, 2 is the middle button, and 3 is the right button.
modifiersAn integer value corresponding to the modifier key constant values. This property is associated with mouse clicks and key presses. The modifier key values are: ALT_MASK, CONTROL_MASK, SHIFT_MASK, and META_MASK.

Note that we'll demonstrate these properties next, so don't worry if you're not quite sure how to use them. Just keep on reading.

https://www.internet.com


Created: December 16, 1997
Revised: December 20, 1997

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