如果使用<img width="50" height="50">这样设置后恐怕不行,可以这样实现:<img src="1.jpg" id="myImg" onload="getImgSize(this)" onclick="resizeImg(this)">
<script language="javascript">
function getImgSize(img)
{
document["w"]=img.width;
document["h"]=img.height;
img.width=50;
img.height=50;
}
function resizeImg(img)
{
img.style.width=document["w"];
img.style.height=document["h"];
}
</script>