Image heightAtributo
Objeto Image
Definición y uso
El atributo height puede establecer o devolver el valor del atributo height de la imagen.
El atributo height especifica la altura de la imagen.
Sintaxis
imageObject.height=pixels
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten el atributo height.
Ejemplo
Ejemplo
El siguiente ejemplo establece la altura y el ancho de la imagen:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
<script>
function changeSize(){
document.getElementById("compman").height="250";
document.getElementById("compman").width="300";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif.html" width="107" height="98">
<br><br>
<input type="button" onclick="changeSize()" value="Modificar tamaño de la imagen">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
<script>
function changeSize(){
document.getElementById("compman").height="250";
document.getElementById("compman").width="300";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif.html" width="107" height="98">
<br><br>
<input type="button" onclick="changeSize()" value="Modificar tamaño de la imagen">
</body>
</html>
Pruébalo »
Objeto Image Otras extensiones