HTML DOM height 属性

定义和用法

height 属性可设置或返回 iframe 的高度(以像素或百分比为单位)。

语法

  1. iframeObject.height=pixels

实例

下面的例子可更改 iframe 的高度:

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function changeHeight()
  5. {
  6. document.getElementById("frame1").height="200";
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <iframe src="frame_a.htm" id="frame1" height="100"></iframe>
  13. <br /><br />
  14.  
  15. <input type="button" onclick="changeHeight()"
  16. value="Change height" />
  17.  
  18. </body>
  19. </html>