Window outerWidth 和 outerHeight 属性
Window 对象
定义和用法
outerHeight属性设置或返回一个窗口的外部高度,包括所有界面元素(如工具栏/滚动条)。
outerWidth属性设置或返回窗口的外部宽度,包括所有的界面元素(如工具栏/滚动)。
注意: 使用 innerWidth 和 innerHeight 属性获取去除工具条与滚动条的窗口高度与宽度。
语法
Get:
window.outerWidth
window.outerHeight
Set:
window.outerWidth=pixels
window.outerHeight=pixels
浏览器支持
![Internet Explorer Internet Explorer](http://run.jb51.net/uploadfile/2017/0619/20170619044846460.gif)
![Firefox Firefox](http://run.jb51.net/uploadfile/2017/0619/20170619044846649.gif)
![Opera Opera](http://run.jb51.net/uploadfile/2017/0619/20170619044846451.gif)
![Google Chrome Google Chrome](http://run.jb51.net/uploadfile/2017/0619/20170619044846528.gif)
![Safari Safari](http://run.jb51.net/uploadfile/2017/0619/20170619044846518.gif)
所有主流浏览器都支持 outerWidth 和 outerHeight 属性。
注意:IE 8 及更早 IE 版本不支持该属性。
实例
实例
获取窗口的高度与宽度(包括工具栏/滚动):
var w=window.outerWidth;
var h=window.outerHeight;
尝试一下 »
Window 对象