event Properties DHTML Events
DOM Level 2 Specification.
Retrieves the horizontal position of the mouse relative to the size of the client area.
HTML |
N/A |
Script |
[ iXPos = ] event.clientX |
iXPos |
Integer specifying the x-coordinate of the mouse hit position, in pixels. |
The property is read-only with no default value.
This property returns the x-coordinate of the cursor position at which the event occurred, relative to the left edge of the size of the window area, excluding any window menus, borders or scroll bars.
The following example demonstrates use of the clientX 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=' +
window.event.clientX +
' Y=' + window.event.clientY"
ondblclick="clientCoords ( )">
This feature requires Microsoft® Internet Explorer® 4.0 or later.
Show me
event
clientY, offsetX, offsetY, screenX, screenY