HTML DOM IFrame atributo width
Definición y Uso
conjuntos de propiedades de anchura o anchura de los retornos elemento iframe valores de los atributos.
atributo width especifica la anchura del iframe.
gramática
iframeObject.width=value
atributo ancho puede tener los siguientes valores:
值 | 描述 |
---|---|
pixels | 以像素作为单位 (如"100px" 或者 "100") |
% | 以百分比作为宽度 (如 "20%") |
Soporte para el navegador
Todos los principales navegadores soportan atributo width
Ejemplos
Ejemplos
Cambiar el alto y el ancho de marco flotante:
<!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>
Trate »
Frame / objetos IFrame