DekGenius.com
Team LiB   Previous Section   Next Section
MouseEvent details about a mouse event

Availability

DOM Level 2 Events

Inherits from/Overrides

Event figs/U2192.gif UIEvent figs/U2192.gif MouseEvent

Properties

readonly boolean altKey

Whether the Alt key was held down when the event occurred. Defined for all types of mouse events.

readonly unsigned short button

Which mouse button changed state during a mousedown, mouseup, or click event. A value of 0 indicates the left button, a value of 2 indicates the right button, and a value of 1 indicates the middle mouse button. Note that this property is defined when a button changes state; it is not used to report whether a button is held down during a mousemove event, for example. Also, this property is not a bitmap: it cannot tell you if more than one button is held down.

Netscape 6.0 and 6.01 use the values 1, 2, and 3 instead of 0, 1, and 2. This is fixed in Netscape 6.1.

readonly long clientX, clientY

Numbers that specify the X and Y coordinates of the mouse pointer relative to the "client area," or browser window. Note that these coordinates do not take document scrolling into account; if an event occurs at the very top of the window, clientY is 0 regardless of how far down the document has been scrolled. These properties are defined for all types of mouse events.

readonly boolean ctrlKey

Whether the Ctrl key was held down when the event occurred. Defined for all types of mouse events.

readonly boolean metaKey

Whether the Meta key was held down when the event occurred. Defined for all types of mouse events.

readonly EventTarget relatedTarget

Refers to a node that is related to the target node of the event. For mouseover events, it is the node the mouse left when it moved over the target. For mouseout events, it is the node the mouse entered when leaving the target. relatedTarget is undefined for other types of mouse events.

readonly long screenX, screenY

Numbers that specify the X and Y coordinates of the mouse pointer relative to the upper-left corner of the user's monitor. These properties are defined for all types of mouse events.

readonly boolean shiftKey

Whether the Shift key was held down when the event occurred. Defined for all types of mouse events.

Methods

initMouseEvent( )

Initializes the properties of a newly created MouseEvent object.

Description

This interface defines the type of Event object that is passed to events of types click, mousedown, mousemove, mouseout, mouseover, and mouseup. Note that in addition to the properties listed here, this interface also inherits the properties of the UIEvent and Event interfaces.

See Also

Event, UIEvent; Chapter 19

    Team LiB   Previous Section   Next Section