event Properties DHTML Events
DOM Level 2 Specification.
Retrieves the vertical position of the mouse relative to the size of the client area.
HTML |
N/A |
Script |
[ iYPos = ] event.clientY |
iYPos |
Integer specifying the y-coordinate of the mouse hit position, in pixels. |
The property is read-only with no default value.
This property returns the y-coordinate of the cursor position at which the event occurred, relative to the top edge of the size of the window area, excluding any window menus, borders or scroll bars.
The following example demonstrates use of the clientY property to determine the mouse position relative to the window. The status window shows the mouse position at all times.
<script language="JavaScript">
function clientCoords ( ) {
var offsetInfo = ""
clientInfo = "The x coordinate is: " +
window.event.clientX + "\r"
clientInfo += "The y coordinate is: " +
window.event.clientY + "\r"
alert ( clientInfo );
}
</script>
</head>
<body onmousemove="window.status "X=' +
this.clientX + ' Y=' + this.clientY"
ondblclick="clientCoords ( )">
This feature requires Microsoft® Internet Explorer® 4.0 or later.
Show me
event
clientX, offsetX, offsetY, screenX, screenY