我只懂一点js,或许这个可以<script>
function newp(id){
if(document.getElementById(id).width>300){
document.getElementById(id).width=300
}
}
</script>
<img src="美女.jpg" id="p" width="400" onload=newp(this.id)>
function newp(id){
if(document.getElementById(id).width>300){
document.getElementById(id).width=300
}
}
</script>
<img src="美女.jpg" id="p" width="400" onload=newp(this.id)>
function checkSize(oImg)
{
var LIMIT_WIDTH = 300; //图片限制宽度
if (oImg.width > LIMIT_WIDTH)
{
oImg.height = oImg.height * LIMIT_WIDTH / oImg.width;
oImg.width = LIMIT_WIDTH;
}
}
</SCRIPT>
<IMG SRC="http://ad4.sina.com.cn/sina/game/wangxing-ent0410-46895.gif" BORDER=0 onload="checkSize(this)">