改成这样就可以了,第二个问题估计是加的时候当字符串加了,加个parseInt试试
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title></head><body>
<center>
<img id=MainImg onmouseover=max() onmouseout=min() src="http://community.csdn.net/logo/images/prj.210.67.gif" width="85" height="55"> 
</center>
<script>
var i=0
//变大
var a;
function max(){
if(a!=null)
clearTimeout(a);
MImg=MainImg.style.pixelWidth+=i++
MainImg.style.pixelHeight=MImg*aaa
if(i<20)a=setTimeout('max()',100)
}//变小
function min(){
if(a!=null)
clearTimeout(a);
MImg=MainImg.style.pixelWidth-=i--
MainImg.style.pixelHeight=MImg*aaa
if(i>0)a=setTimeout('min()',100)
}function init(){
aaa=MainImg.height/MainImg.width
MainImg.style.pixelWidth=95
MainImg.style.pixelHeight=55
}onload=init
</script></body>
</html>