var flag=false; 
function DrawImage(ImgD,width,height){ 
 var image=new Image(); 
 var w = width;
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= w/w){ 
   if(image.width>w){
    ImgD.width=w; 
    ImgD.height=(image.height*w)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  // ImgD.alt="实际大小："+image.width+"x"+image.height; 
  } 
  else{ 
   if(image.height>w){
    ImgD.height=w; 
    ImgD.width=(image.width*w)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
  // ImgD.alt="实际大小："+image.width+"x"+image.height; 
  } 
 }
}
