//调用方式：<img src="<%=rs("tou")%>" onload="javascript:DrawImage2(this);"/>
//主要是加上onload那一句话
var kuan=180;//图片宽度
var gao=180;//图片高度
var flag=false;
function DrawImage2(ImgD){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= kuan/gao){
     if(image.width>kuan){
     ImgD.width=kuan;
     ImgD.height=(image.height*kuan)/image.width;
     }else{
     ImgD.width=image.width;
     ImgD.height=image.height;
     }
     }
    else{
     if(image.height>gao){
     ImgD.height=gao;
     ImgD.width=(image.width*gao)/image.height;
     }else{
     ImgD.width=image.width;
     ImgD.height=image.height;
     }
     }
    }
  }