Name
MouseEvent — details about a mouse event
Availability
DOM Level 2 Events
Inherits from/Overrides
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.
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 ...
Get JavaScript: The Definitive Guide, Fourth 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.