asp.net.ph

Skip Navigation Links

clientX Property

event Properties   DHTML Events


DOM Level 2 Specification.

Retrieves the horizontal position of the mouse relative to the size of the client area.

Syntax

HTML N/A
Script [ iXPos = ] event.clientX

Possible Values

iXPos Integer specifying the x-coordinate of the mouse hit position, in pixels.

The property is read-only with no default value.

Remarks

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.

Example

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 ( )">

 Show me 

Applies To

event

See Also

clientY, offsetX, offsetY, screenX, screenY


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note