Window screenLeft and screenTop Properties
Example
Return the x and y coordinates of the new window relative to the screen:
var
myWindow = window.open("", "myWin");
myWindow.document.write("<p>This is 'myWin'");
myWindow.document.write("<br>ScreenLeft: " + myWindow.screenLeft);
myWindow.document.write("<br>ScreenTop: " + myWindow.screenTop
+ "</p>");
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The screenLeft and screenTop properties returns the x (horizontal) and y (vertical) coordinates of the window relative to the screen.
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
screenLeft | Yes | Yes | 64.0 | Yes | Yes |
screenTop | Yes | Yes | 64.0 | Yes | Yes |
Syntax
window.screenLeft
window.screenTop
Technical Details
Return Value: | A Number, representing the horizontal and vertical distance of the window relative to the screen, in pixels |
---|
❮ Window Object