Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Properties
 y Property
y Property

Sets or retrieves the y-coordinate (in pixels) of the mouse pointer's offset from the closest relatively positioned parent element of the element that fired the event.

Syntax

[ iY = ] object.y

Possible Values

iYInteger that specifies or receives the y-coordinate, in pixels.

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

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. 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. In browser versions earlier than Internet Explorer 5, the y property retrieves a coordinate relative to the client.

If the event firing element is relatively positioned, then the y-coordinate from the boundary of the element is returned. If the event firing element and all of its parent elements are not relatively positioned, then the y property returns a coordinate relative to the body element.

If the mouse is outside the window at the time the event fires, this property returns -1.

Example

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

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

Standards Information

There is no public standard that applies to this property.

Applies To

event, Event Constructor
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker