Window screenLeft属性用于返回窗口相对于屏幕的“ x”或水平坐标。它返回一个数字,该数字表示窗口相对于屏幕的水平坐标。
用法:
window.screenLeft
以下示例程序旨在说明Window screenLeft属性:
获取窗口相对于屏幕的水平坐标。
Window screenLeft Property in HTML
h1 {
color:green;
}
h2 {
font-family:Impact;
}
body {
text-align:center;
}
GeeksforGeeks
Window screenLeft Property
For returning the X coordinates of
a window relative to the screen,
double click the "Check Screen
Left" button:
Check Screen Left
function coordinate() {
var x = window.open("", "myWindow");
x.document.write
("
Welcome to my Window");
x.document.write
("
ScreenLeft:" + x.screenLeft);
}
输出:
单击按钮后
支持的浏览器:下面列出了Window screenLeft属性支持的浏览器:
谷歌浏览器
IE浏览器
Opera
Safari