width

收藏:0   阅读:19

Image width 属性


定义和用法

width 属性可设置或者返回图片的width属性的值。

width 属性指定了图片的宽度。

语法

imageObject.width=pixels


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 width 属性


实例

改变图片的高度与宽度:

<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>

© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!