小码哥的IT人生

HTML DOM outerwidth 属性

JavaScript基础 2022-06-08 14:57:54小码哥的IT人生shichen

HTML DOM outerwidth 属性

定义和用法

outerwidth 属性是一个只读的整数,声明了整个窗口的宽度。

语法

window.outerwidth=pixels

提示和注释

提示:IE 不支持此属性,且没有提供替代的属性。

实例

下面的例子可把新窗口设置为 100x100 像素:

<script type="text/javascript">
myWindow=window.open('','')
myWindow.outerheight="100"
myWindow.outerwidth="100"
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>

TIY

完整实例【设置窗口的高度和宽度】:

<!doctype html>
<html>
<body>
<script type="text/javascript">
myWindow=window.open('','')
myWindow.outerheight="100"
myWindow.outerwidth="100"
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>
</body>
</html>

可以使用本站在线JavaScript测试工具测试上述代码运行效果:http://www.phpcodeweb.com/runjs.html

版权所有 © 小码哥的IT人生
Copyright © phpcodeweb All Rights Reserved
ICP备案号:苏ICP备17019232号-2  

苏公网安备 32030202000762号

© 2021-2024