Easy Tutorial
❮ Jsref Setutchours Jsref From ❯

Window screenLeft and screenTop Properties


Definition and Usage

The screenLeft and screenTop properties return the X and Y coordinates of the window relative to the screen.

Syntax


Browser Support

All major browsers support the screenLeft and screenTop properties, except Firefox.

Note: For Firefox, use "window.screenX" and "window.screenY".


Example

Return the X and Y coordinates of the new window relative to the screen:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function openWin(){
    myWindow=window.open('','');
    myWindow.document.write("<p>This is 'my window'");
    myWindow.document.write("<br>ScreenLeft: " + myWindow.screenLeft);
    myWindow.document.write("<br>ScreenTop: " + myWindow.screenTop + "</p>");
}</script>
</head>
<body>

<input type="button" value="Open 'my window'" onclick="openWin()">

</body>
</html>

❮ Jsref Setutchours Jsref From ❯