Window innerHeight 屬性
- 上一頁 getComputedStyle()
- 下一頁 innerWidth
- 返回上一層 Window 對象
定義和用法
innerHeight
屬性返回窗口內容區域的高度。
innerHeight
屬性是只讀的。
另請參閱:
實例
例子 1
獲取窗口高度:
let height = window.innerHeight;
let height = innerHeight;
例子 2
所有高度和寬度屬性:
let text = "<p>innerWidth: " + window.innerWidth + "</p>" + "<p>innerHeight: " + window.innerHeight + "</p>" + "<p>outerWidth: " + window.outerWidth + "</p>" + "<p>outerHeight: " + window.outerHeight + "</p>";
語法
window.innerHeight
或者:
innerHeight
返回值
類型 | 描述 |
---|---|
數字 | 瀏覽器窗口內容區域的內部高度(以像素計)。 |
瀏覽器支持
所有瀏覽器都支持 window.innerHeight
:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
支持 | 9-11 | 支持 | 支持 | 支持 | 支持 |
- 上一頁 getComputedStyle()
- 下一頁 innerWidth
- 返回上一層 Window 對象