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版本不支持這兩個屬性。
實例
Window對象