複製程式碼程式碼如下: <BR> DrawImage(ImgD,FitWidth,FitHeight){ <BR> var image=new Image(); <BR> image.src=ImgD.src; <BR> if(image.width>0 && image.height>0){ <BR> if(image.width/image.height age.width>FitWidth){ <BR> ImgD.width=FitWidth; <BR> ImgD.height=(image.height*FitWidth)/image.width; <BR> } <BR> else{ < <BR> ImgD.height=image.height; <BR> } <BR> } <BR> FitHeight){ <BR> ImgD.height=FitHeight; <BR> ImgD.width=(image.width*FitHeight)/image.height; <BR> } <BR> else{ < <BR> ImgD.height=image.height; <BR> } <BR> } <BR> } <BR>呼叫方法: 複製程式碼複製程式碼程式碼如下: