Windows apps
Collapse the table of content
Expand the table of content

clientY property

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

Syntax

JavaScript

p = object.clientY

Property values

Type: Integer

the y-coordinate, in pixels.

Remarks

Because the clientY property returns a value relative to the client, you can add the value of the scrollTop property to determine the distance of the y-coordinate from the edge of the body element.

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

Examples

This example uses the clientY 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"
    console.log(clientInfo);
}
</script>
</head>
<body onmousemove="window.status = 'X=' + this.clientX + ' Y=' + 
        this.clientY"
    ondblclick="clientCoords()">

 

 

Send comments about this topic to Microsoft

Build date: 11/26/2012

Show:
© 2016 Microsoft