| |||||||||||||||||||
offsetY PropertyDOM Level 2 Specification. Retrieves the vertical position of the mouse relative to the object firing the event. Syntax
Possible Values
The property is read-only with no default value. RemarksThis property returns the y-coordinate of the cursor position at which the event occurred, relative to the top edge of the object where the event is contained. The coordinates match the offsetLeft and offsetTop properties of the object. Use offsetParent to find the container object that defines this coordinate system. ExampleThe following example demonstrates use of the offsetY property to determine the mouse position relative to the container that fired the event. The status window shows the mouse position at all times relative to the body. <script language="JavaScript">
function offsetCoords ( ) {
var el = event.srcElement.tagName;
var offsetInfo = "";
offsetInfo = "The offsetX coordinate
relative to the "+el+" is: " +
window.event.offsetX + "\r"
offsetInfo += "The offsetY coordinate
relative to the "+el+" is: " +
window.event.offsetY + "\r"
alert ( offsetInfo );
}
</script>
<body onmousemove="window.status='X " + window.event.offsetX + ' Y " + window.event.offsetY" ondblclick="offsetCoords ( )"> Double click anywhere ... <div onclick="offsetCoords ( );" style="width:400; background:black; color:khaki; padding:20">Click in this black ... </div> This feature requires Microsoft® Internet Explorer® 4.0 or later. Applies ToSee AlsoclientX, clientY, offsetX, screenX, screenY |
| ||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme