Name

MouseEvent: details about a mouse event — DOM Level 2 Events: Event → UIEvent → 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.

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

Refers to a document node that is related to the target node of the event. For mouseover events, it is the node the mouse ...

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.