﻿// JScript 文件
function resizeimg(ImgD) {
     var iwidth=90;
     var iheight=90;
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0){
        if(image.width/image.height>= iwidth/iheight){
           if(image.width>iwidth){
               ImgD.width=iwidth;
               ImgD.height=(image.height*iwidth)/image.width;
               ImgD.style.margin=(iheight - ImgD.height)/2 + "px 0px 0px 0px;";
           }else{
                  ImgD.width=image.width;
                  ImgD.height=image.height;
                  ImgD.style.margin=(iheight - image.height)/2 + "px 0px 0px " + (iwidth - image.width)/2 + "px;";
                }
               ImgD.alt=ImgD.alt;
        }
        else{
                if(image.height>iheight){
                       ImgD.height=iheight;
                       ImgD.width=(image.width*iheight)/image.height;
                       ImgD.style.margin="0px 0px 0px " + (iwidth - ImgD.width)/2 + "px;";
                }else{
                        ImgD.width=image.width;
                        ImgD.height=image.height;
                        ImgD.style.margin=(iheight - image.height)/2 + "px 0px 0px " + (iwidth - image.width)/2 + "px;";
                     }
                ImgD.alt=ImgD.alt;
                
            }
ImgD.style.cursor= "pointer"; //改变鼠标指针
    ImgD.onclick = function() 
    {
    if(this.name.length<1)
    {
     return;
     }
     window.open(this.name);
    } //打开URL地址

 }
    
}

