Latest web development tutorials

Window screenX and screenY property

Window Object Reference Window object

Definition and Usage

screenX and screenY property returns window relative to the X and Y coordinates of the screen.

grammar

window.screenX
window.screenY


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

In addition to Internet Explorer, all major browsers support screenX and screenY properties.

Note: IE browsers." Window.screenLeft " and " window.screenTop " to get the same value


Examples

Examples

Returns a new window relative to the X and Y coordinates of 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>

try it"


Window Object Reference Window object