You are here: Reference > JavaScript > client-side > browser > properties > screenTop (window)

screenTop property (window)

Browser support:
Returns an integer value that indicates the vertical position of the top side of the browser's client area, relative to the top side of the screen.
This property retrieves the vertical position of the top side of the browser window instead of the browser's client area in Google Chrome and Safari. There is no property or method in JavaScript to get the position of the top-left corner of the client area in Firefox, Google Chrome and Safari. The browser window can be resized with the resizeBy and resizeTo methods, and can be moved with the moveBy and moveTo methods.
If you need information about the dimensions of the screen, use the screen object.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Integer that represents the y-coordinate of the top side, in pixels.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the screenTop property:
    <script type="text/javascript">
        function UpdatePos () {
            var message = "";
            if ('screenLeft' in window) {
                message += "Client area: " + window.screenLeft + "px, " + window.screenTop + "px<br/>";
            if ('screenX' in window) {
                message += "Browser window: " + window.screenX + "px, " + window.screenY + "px";

            var info = document.getElementById ("info");
            info.innerHTML = message;
<body onload="UpdatePos ()">
    <b>Left, top positions:</b>
    <div id="info" style="height:65px; width:250px; background-color:#e0a0a0;"></div>
    <button onclick="UpdatePos ();">Update positions!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content