Window innerWidth 和 innerHeight 屬性

定義和用法
innerheight 返回窗口的文檔顯示區的高度。
innerwidth 返回窗口的文檔顯示區的寬度。
注意:使用 outerWidth 和 outerHeight 屬性獲取加上工具條與滾動條窗口的寬度與高度。
語法
Get:
window.innerWidth
window.innerHeight
window.innerHeight
設置:
window.innerWidth=pixels
window.innerHeight=pixels
window.innerHeight=pixels
流覽器支持
所有主流流覽器都支持 innerWidth 和 innerHeight 屬性。
注意:IE 8 及更早 IE版本不支持這兩個屬性。
實例
實例
獲取窗口的高度與寬度(不包含工具條與滾動條):
var w=window.innerWidth;
var h=window.innerHeight;
var h=window.innerHeight;
