﻿// JScript 文件

var flag=false;
var image=new Image();
function DrawImage(ImgD, Imgw, Imgh)
{
    image.src=ImgD.src;
    if(image.width>0 && image.height>0)
    {
        flag=true;
        if(image.width/image.height>= Imgw/Imgh)
        {
            if(image.width>Imgw)
            {
                ImgD.width=Imgw;
                ImgD.height=(image.height*Imgw)/image.width;
            }
            else
            {
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
            ImgD.alt=image.width+"x"+image.height;
        }
        else
        {
            if(image.height>Imgh)
            {
                ImgD.height=Imgh;
                ImgD.width=(image.width*Imgh)/image.height;
            }
            else
            {
                ImgD.width=image.width;
                ImgD.height=image.height;
            }
            ImgD.alt=image.width+"x"+image.height;
        }
    }
}
