Image height 属性

定义和用法
height 属性可设置或者返回图片的 height 属性值。
height 属性指定了图片的高度。
语法
imageObject.height=pixels
浏览器支持
所有主要浏览器都支持 height 属性
实例
实例
下面的例子可设置图像的高度和宽度:
<html>
<head>
<script>
function changeSize()
{
document.getElementById("compman").height="250";
document.getElementById("compman").width="300";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" width="107" height="98">
<br><br>
<input type="button" onclick="changeSize()" value="Change size of image">
</body>
</html>
<head>
<script>
function changeSize()
{
document.getElementById("compman").height="250";
document.getElementById("compman").width="300";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif" width="107" height="98">
<br><br>
<input type="button" onclick="changeSize()" value="Change size of image">
</body>
</html>
尝试一下 »

更多建议: