screenY

« DOM Reference

Summary

Returns the vertical coordinate of the event within the screen as a whole.

Syntax

var pixelNumber = event.screenY; 
  • pixelNumber is the offset from the top of the screen in pixels.

Example

<html>
<head>
<title>screenX\screenY example</title>

<script type="text/javascript">

function showCoords(evt){
  alert(
    "screenX value: " + evt.screenX + "\n"
    + "screenY value: " + evt.screenY + "\n"
  );
}

</script>
</head>

<body onmousedown="showCoords(event)">
<p>To display the mouse coordinates click anywhere on the page.</p>
</body>
</html>

Notes

When you trap events on the window, document, or other roomy elements, you can get the coordinates of that event (e.g., a click) and route it properly, as the "clickMap" example demonstrates.

Specification

screenY

Document Tags and Contributors

 Contributors to this page: Dria
 Last updated by: Dria,