📅  最后修改于: 2023-12-03 14:41:54.030000             🧑  作者: Mango
screenTop
属性返回当前窗口相对于屏幕顶部的距离。
window.screenTop
<!DOCTYPE html>
<html>
<head>
<title>screenTop property example</title>
</head>
<body>
<h2>screenTop property example</h2>
<p>Click the button to display the screenTop property of the current window.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = "screenTop property value is: " + window.screenTop + "px";
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
点击"Try it"按钮,页面将显示窗口 screenTop
属性的值。