HTML DOM width 属性
定义和用法
width 属性可设置或返回 iframe 的宽度(以像素或百分比为单位)。
语法
- iframeObject.width=pixels
实例
下面的例子可更改 iframe 的宽度:
- <html>
- <head>
- <script type="text/javascript">
- function changeWidth()
- {
document.getElementById("frame1").width="100";
- }
- </script>
- </head>
- <body>
- <iframe src="frame_a.htm" id="frame1" width="200"></iframe>
- <br /><br />
- <input type="button" onclick="changeWidth()"
- value="Change size" />
- </body>
- </html>