screenY只读属性返回的垂直距离,以像素为单位,从用户的浏览器窗口到屏幕的上侧的上边框。
screenY属性是较新的screenTop属性的别名。
window.screenY
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属性。
所有浏览器完全支持screenY属性:
属性 | |||||
screenY | 是 | 是 | 是 | 是 | 是 |
返回值: | 从浏览器视口的顶部边缘到屏幕顶部的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.screenX属性
窗口(Window)参考:window.screenTop属性
窗口(Window)参考:window.screenLeft属性