Window innerHeight属性用于返回窗口内容区域的高度。这是一个只读属性,返回一个数字,该数字表示浏览器窗口内容区域的高度(以像素为单位)。
用法:
window.innerHeight
以下示例程序旨在说明Window innerheight属性:
返回当前框架的高度。
Window innerHeight Property in HTML
h1 {
color:green;
}
h2 {
font-family:Impact;
}
body {
text-align:center;
}
GeeksforGeeks
Window innerHeight Property
For returning the current frame's height,
double click the "Check Height" button:
Check Height
function height() {
var h = window.innerHeight;
document.getElementById("measure").innerHTML
= "Frame's Height:" + h;
}
输出:
单击按钮后
支持的浏览器:下面列出了Window innerHeight属性支持的浏览器:
谷歌浏览器
IE浏览器
Firefox
Opera
Safari