Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


clientX Property

Sets or retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.

Syntax

event . clientX [ = iXPos ]

Possible Values

iXPos Integer that specifies or receives the x-coordinate, in pixels.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties .

Remarks

The property is read-only in Microsoft® Internet Explorer 4.0, and read/write in Internet Explorer 5 and later.

Because the clientX property returns a value relative to the client, you can add the value of the scrollLeft property to determine the distance of the x-coordinate from the edge of the body element.

Within a viewlink, the client area begins at the edge of the master element.

Example

This example uses the clientX property to determine the mouse position relative to the window. The status window shows the mouse position at all times.

 

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

Standards Information

There is no public standard that applies to this property.

Applies To

[ Object Name ] Platform Version
Win16:
Win32:
Unix:
Mac:
Windows CE:
 
event
Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.