DOM HTML IFrame propriété height
Structure / objets iFrame
Définition et utilisation
ensembles de propriétés de hauteur ou retourne la valeur de l'attribut de la hauteur de l'élément iframe.
attribut hauteur iframe spécifie la hauteur (en pixels ou en pourcentage).
grammaire
iframeObject.height=value
attribut de hauteur peut avoir les valeurs suivantes:
值 | 描述 |
---|---|
pixels | height 属性单位可以是像素 (如 "100px" 或者 "100") |
% | height 属性单位可以是百分比 (如"20%") |
support du navigateur
Tous les principaux navigateurs prennent en charge l'attribut de la hauteur
Exemples
Exemples
Changer la hauteur iframe et largeur:
<!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>
Essayez »
Structure / objets iFrame