Open a new window with a specified left and top position, and return its coordinates:
const myWin = window.open("", "", "left=700,top=350,width=200,height=100");
let x = myWin.screenX;
let y = myWin.screenY;
Try it Yourself »
More examples below.
The screenX
property returns the x (horizontal) coordinate of a window, relative to the screen.
window.screenX
screenX
NONE |
Parameter | Description |
A number | The horizontal distance of the window relative to the screen, in pixels |
Open a new window and return its coordinates:
const myWin = window.open("", "", "width=200,height=100");
let x = myWin.screenX;
let y = myWin.screenY;
Try it Yourself »
window.screenX
is supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 10-11 | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!