Output the coordinates of the mouse pointer when the mouse button is clicked on an element:
The result of coor could be:
More "Try it Yourself" examples below.
The clientY property returns the vertical coordinate (according to the client area) of the mouse pointer when a mouse event was triggered.
The client area is the current window.
Tip: To get the horizontal coordinate (according to the client area) of the mouse pointer, use the clientX property.
Note: This property is read-only.
|Return Value:||A Number, representing the vertical coordinate of the mouse pointer, in pixels|
|DOM Version:||DOM Level 2 Events|
Output the coordinates of the mouse pointer while the mouse pointer moves over an element:
A demonstration of the differences between clientX and clientY and screenX and screenY:
HTML DOM reference: MouseEvent clientX Property
HTML DOM reference: MouseEvent screenX Property
HTML DOM reference: MouseEvent screenY Property