/

HTML / CSS / JavaScript Tutorial

JavaScript Properties and Methods for MouseEvent objects

[this page | pdf | back links]

MouseEvent objects within the JavaScript DOM support the following properties:

 

Properties (when mouse event is triggered):

 

Property

Description

More

altKey

Returns true if ‘ALT’ key was pressed, otherwise returns false

Here

button

Returns which mouse button was pressed

Here

buttons

Returns which mouse buttons were pressed

Here

clientX

Returns horizontal coordinate of mouse pointer (relative to current window)

Here

clientY

Returns vertical coordinate of mouse pointer (relative to current window)

Here

ctrlKey

Returns true if ‘CTRL’ key was pressed, otherwise returns false

Here

detail

Returns number indicating number of times mouse was clicked

Here

metaKey

Returns true if ‘META’ key was pressed, otherwise returns false

Here

pageX

Returns horizontal coordinate of mouse pointer (relative to page)

Here

pageY

Returns vertical coordinate of mouse pointer (relative to page)

Here

relatedTarget

Returns element related to element that triggered mouse event

Here

screenX

Returns horizontal coordinate of mouse pointer (relative to screen)

Here

screenY

Returns vertical coordinate of mouse pointer (relative to screen)

Here

shiftKey

Returns true if ‘SHIFT’ key was pressed, otherwise returns false

Here

which

Returns which mouse button was pressed (more consistent between browsers than the button property)

Here

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile