﻿/*调用改变图片大小onload='javascript:DrawImage(this,65,90);*/
var flag=false; 
function DrawImage(ImgD,h,w){ 
    var image=new Image(); 
    image.src=ImgD.src; 
    if(image.width > 0 && image.height > 0){ 
        flag=true;
        if(image.width/image.height >= h/w){        
            if(image.width > h){ 
                ImgD.width=h;
                ImgD.height=(image.height*h)/image.width; 
            }
            else
            { 
                ImgD.width=image.width; 
                ImgD.height=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; 
            } 
        } 
    } 
} 