clientYEvent Property
Event Object
Definition and Usage
The clientY event property returns the vertical coordinate of the mouse pointer relative to the browser page (client area) when the event is triggered. The client area refers to the current window.
Syntax
event.clientY
Example
Example
The following example shows the coordinates of the mouse pointer when the event occurs:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
<script>
function show_coords(event){
var x=event.clientX;
var y=event.clientY;
alert("X coords: " + x + ", Y coords: " + y);
}
</script>
</head>
<body>
<p onmousedown="show_coords(event)">Please click in the document. A message box will show the x and y coordinates of the mouse pointer.</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
<script>
function show_coords(event){
var x=event.clientX;
var y=event.clientY;
alert("X coords: " + x + ", Y coords: " + y);
}
</script>
</head>
<body>
<p onmousedown="show_coords(event)">Please click in the document. A message box will show the x and y coordinates of the mouse pointer.</p>
</body>
</html>
Try it yourself »
Event Object Other Extensions