Section 25.205. MouseEvent: details about a mouse event


25.205. MouseEvent: details about a mouse event

DOM Level 2 Events: Event UIEvent MouseEvent

25.205.1. 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.


readonly long clientX, clientY

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 Element relatedTarget

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


readonly long screenX, screenY

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.

25.205.2. Methods


initMouseEvent( )

Initializes the properties of a newly created MouseEvent object.

25.205.3. 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.

25.205.4. See Also

Event, UIEvent; Chapter 17




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net