Image width 属性

定义和用法
width 属性可设置或者返回图片的width属性的值。
width 属性指定了图片的宽度。
语法
imageObject.width=pixels
浏览器支持
所有主要浏览器都支持 width 属性
实例
改变图片的高度与宽度:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function changeSize() { document.getElementById("compman").height = "250"; document.getElementById("compman").width = "300"; } </script> </head> <body> <img id="compman" src="/examples/compman.gif" width="107" height="98"> <br><br> <input type="button" onclick="changeSize()" value="修改图像大小"> </body> </html>
