HTML DOM MouseEvent

MouseEvent object

Events that occur when interacting with the HTML document through the mouse belong to the MouseEvent object.

Mouse event properties and methods

Property/Method Description
altKey Returns whether the "ALT" key was pressed when the mouse event was triggered.
button Returns the mouse button pressed when the mouse event is triggered.
buttons Returns the mouse button pressed when the mouse event is triggered.
clientX Returns the horizontal coordinate of the mouse pointer relative to the current window when the mouse event is triggered.
clientY Returns the vertical coordinate of the mouse pointer relative to the current window when the mouse event is triggered.
ctrlKey Returns whether the "CTRL" key was pressed when the keyboard event was triggered.
getModifierState() Returns true if the specified key is activated.
metaKey Returns whether the "META" key was pressed when the event was triggered.
movementX Returns the horizontal coordinate of the mouse pointer relative to the position of the previous mousemove event.
movementY Returns the vertical coordinate of the mouse pointer relative to the position of the previous mousemove event.
offsetX Returns the horizontal coordinate of the mouse pointer relative to the edge of the target element.
offsetY Returns the vertical coordinate of the mouse pointer relative to the edge of the target element.
pageX Returns the horizontal coordinate of the mouse pointer relative to the document when the mouse event is triggered.
pageY Returns the vertical coordinate of the mouse pointer relative to the document when the mouse event is triggered.
region  
relatedTarget Returns the element related to the element associated with the mouse event.
screenX Returns the horizontal coordinate of the mouse pointer relative to the screen when the event was triggered.
screenY Returns the vertical coordinate of the mouse pointer relative to the screen when the event was triggered.
shiftKey Returns whether the "SHIFT" key was pressed when the event was triggered.
which Returns the mouse button pressed when the mouse event is triggered.

Inherited properties and methods

The MouseEvent inherits all properties and methods from the following objects:

UiEvent

Συστατικός Όνειρος Event

Event type

These event types belong to the MouseEvent object:

Event Description
onclick This event occurs when the user clicks an element.
oncontextmenu This event occurs when the user right-clicks an element to open a context menu.
ondblclick This event occurs when the user double-clicks an element.
onmousedown This event occurs when the user presses the mouse button on an element.
onmouseenter When the pointer moves over an element, this event occurs.
onmouseleave Αυτό το συμβάν προκύπτει όταν ο δείκτης του ποντικιού απομακρύνεται από το στοιχείο.
onmousemove Αυτό το συμβάν προκύπτει όταν ο δείκτης του ποντικιού κινείται πάνω από το στοιχείο.
onmouseout Αυτό το συμβάν προκύπτει όταν ο χρήστης κινεί το δείκτη του ποντικιού έξω από το στοιχείο ή τα στοιχεία υποσημείωσης.
onmouseover Αυτό το συμβάν προκύπτει όταν ο δείκτης του ποντικιού μετακινείται σε στοιχείο ή στοιχεία υποσημείωσης.
onmouseup Αυτό το συμβάν προκύπτει όταν ο χρήστης απελευθερώνει το κουμπί του ποντικιού στο στοιχείο.