The IFrame height property
Frame/IFrame objectDefinitions and usages
The height property can set or return the value of the height property in the iframe element.
The height property specifies the height, in pixels or percentages, of iframe.
Grammar
The height property can be the following value:
value | describe |
---|---|
pixels | The HEIGHT attribute unit can be pixels (such as "100PX" or "100") |
% | Height attribute unit can be percentage (such as "20%") |
Browser support
The height property is supported by all major browsers
Change the height and width of iframe:
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool在线教程(w3cschool.cn)</title>
<script>
function changeSize(){
document.getElementById("myframe").height="300";
document.getElementById("myframe").width="300";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3cschool.com" rel="external nofollow" height="200" width="200">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeSize()" value="修改大小">
</body>
</html>
Try it out . . .
Frame/IFrame object