This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

MouseEvent

Summary

The DOM MouseEvent interface represents events that occur due to the user interacting with a pointing device (such as a mouse or touchpad).

Inherits from UIEventUIEvent

Properties

button
Gets the mouse button that caused an event.
buttons
Gets a value that indicates which mouse buttons a user pressed.
clientX
Gets the x-coordinate of the mouse pointer, relative to the upper-left corner of the viewport (that is, the user agent’s client area).
clientY
Gets the y-coordinate of the mouse pointer, relative to the upper-left corner of the viewport (that is, the user agent’s client area).
layerX
Gets the x-coordinate of the mouse pointer, relative to the last positioned ancestor element.
layerY
Returns the horizontal coordinate of the event relative to the current layer. layerY is a non-standards property of the MouseEvent object.
relatedTarget
Gets the secondary element that is involved in an event. The relatedTarget property is used to find the other element, if any, involved in an event. Events like mouseover are oriented around a certain target, but also involve a secondary target, such as the target that is exited as the mouseover event fires for the primary target.
screenX
Gets the x-coordinate of the mouse pointer, relative to the upper-left corner of the screen.
screenY
Gets the y-coordinate of the mouse pointer, relative to the upper-left corner of the screen.
x
Gets the x-coordinate of the mouse cursor, relative to the last positioned ancestor element.
y
Gets the y-coordinate of the mouse pointer, relative to the last positioned ancestor element.

Methods

initMouseEvent
Initializes a new mouse event that the createEvent method created.

Events

click
The click event is triggered for an element when it is activated by a mouse click or by another user action that normally has the same effect as a mouse click.
dblclick
A mouse double click event.
mousedown
Fires when the user clicks the object with either mouse button or taps the mouse pad.
mouseenter
Fires when the user moves the mouse pointer into the object.
mouseleave
Fires when the user moves the mouse pointer outside the boundaries of the object.
mousemove
Fires when the user moves the mouse over the object.
mouseout
Fires when the user moves the mouse pointer outside the boundaries of the object.
mouseover
Fires when the user moves the mouse pointer into the object.
mouseup
Fires when the user releases a mouse button while the mouse is over the object.

Inherited from UIEvent

Properties

detail

Gets additional, developer defined, information about an event.

view

Gets the window object that an event is generated from.

[object window]

Methods

initUIEvent
Initializes a new user interface event that the createEvent method created.

Events

abort
Fires when the user aborts the download.
activate
Fires when the object is set as the active element.

Related specifications

DOM Level 3 Events
Working Draft

Attributions