Window screenXandscreenYProperty
Window Object
Definition and Usage
The screenX and screenY properties return the X and Y coordinates of the window relative to the screen.
Syntax
window.screenX
window.screenY
window.screenY
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the screenX and screenY properties except Internet Explorer.
Note:IE browsers use.window.screenLeft" "window.screenTop" " to get the same values
Example
Example
Return the X and Y coordinates of the new window relative to the screen:
<html>
<head>
<script>
function openWin()
{
myWindow=window.open('','');
myWindow.document.write("<p>This is 'myWindow'");
myWindow.document.write("<br>ScreenX: " + myWindow.screenX);
myWindow.document.write("<br>ScreenY: " + myWindow.screenY + "</p>");
}
</script>
</head>
<body>
<input type="button" value="Open 'myWindow'" onclick="openWin()">
</body>
</html>
<head>
<script>
function openWin()
{
myWindow=window.open('','');
myWindow.document.write("<p>This is 'myWindow'");
myWindow.document.write("<br>ScreenX: " + myWindow.screenX);
myWindow.document.write("<br>ScreenY: " + myWindow.screenY + "</p>");
}
</script>
</head>
<body>
<input type="button" value="Open 'myWindow'" onclick="openWin()">
</body>
</html>
Try it Yourself »
Window Object Other Extensions