HTML DOM IFrame을 높이 속성
정의 및 사용
높이 속성 집합 또는 iframe 요소의 높이 속성의 값을 반환합니다.
iframe이 높이 속성 (픽셀 또는 백분율로)의 높이를 지정합니다.
문법
iframeObject.height=value
높이 속성은 다음의 값을 지정할 수 있습니다 :
值 | 描述 |
---|---|
pixels | height 属性单位可以是像素 (如 "100px" 或者 "100") |
% | height 属性单位可以是百分比 (如"20%") |
브라우저 지원
모든 주요 브라우저는 높이 속성을 지원
예
예
iframe이 높이와 너비를 변경합니다 :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function changeSize(){
document.getElementById("myframe").height="300";
document.getElementById("myframe").width="300";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com" height="200" width="200">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeSize()" value="修改大小">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function changeSize(){
document.getElementById("myframe").height="300";
document.getElementById("myframe").width="300";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com" height="200" width="200">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="changeSize()" value="修改大小">
</body>
</html>
»시도
프레임 / IFrame을 객체