screenX只读属性返回从用户浏览器窗口的左边框到屏幕左侧的水平距离(以像素为单位)。
screenX属性是较新的screenLeft属性的别名。
window.screenX
var win = window.open("", "popupWindow"); win.document.write("<p>This is 'popupWindow'"); win.document.write("<br>ScreenX: " + win.screenX); win.document.write("<br>ScreenY: " + win.screenY + "</p>");测试看看‹/›
注意: screenX和screenY属性等于screenLeft和screenTop属性。
所有浏览器完全支持screenX属性:
属性 | |||||
screenX | 是 | 是 | 是 | 是 | 是 |
返回值: | 此数字等于从浏览器视口的左边缘到屏幕左边缘的CSS像素数 |
---|
返回相对于屏幕的新窗口的x和y坐标:
var win = window.open("", "popupWindow", "left=500, top=350, width=300, height=200"); win.document.write("<p>This is 'popupWindow'"); win.document.write("<br>ScreenX: " + win.screenX); win.document.write("<br>ScreenY: " + win.screenY + "</p>");测试看看‹/›
窗口(Window)参考:window.screenY属性
窗口(Window)参考:window.screenTop属性
窗口(Window)参考:window.screenLeft属性