Javascript examples for Browser Object Model:Window screenLeft screenTop
The screenLeft and screenTop properties returns the x (horizontal) and y (vertical) coordinates of the window relative to the screen.
A Number, representing the horizontal and vertical distance of the window relative to the screen, in pixels
The following code shows how to return the x and y coordinates of the new window relative to the screen:
<!DOCTYPE html> <html> <head> <script> function myFunction() {/*from ww w . j a v a2s .c o m*/ 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>"); } </script> </head> <body> <button onclick="myFunction()">Open "myWin"</button> </body> </html>