x Property

DHTML, HTML, & CSS

x Property


Retrieves the x-coordinate of the mouse pointer's position relative to the parent element.

Syntax

HTMLN/A
Scripting[ iX = ] event.x

Possible Values

iXInteger that specifies the x-coordinate, in pixels.

The property is read-only with no default value.

Remarks

In browser versions earlier than Microsoft® Internet Explorer 5, the x property retrieves a coordinate relative to the client.

If the mouse is outside the window when the event is called, this property returns -1. If an element is absolutely positioned and fires a mouse event, or is not the child of an absolutely positioned element, the x property returns a coordinate relative to the BODY element.

Example

This example displays the current mouse position in the browser's status window.

Sample Code

<BODY onmousemove="window.status = 'X=' + window.event.x + 
    ' Y=' + window.event.y">

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
event

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.