亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

js 加載時自動調(diào)整圖片大小

 更新時間:2008年05月28日 22:52:39   作者:  
又一個javascript自動調(diào)整圖片大小的腳本
//  方法:setSelectReadOnly  用于設定極select控件ReadOnly,
//        這個一個模擬只讀不是真的只讀
//        使用了onbeforeactivate,onfocus,onmouseover,onmouseout事件
//    示例:< img src='img.jpg' onload='ImgAutoSize(ImgD,FitWidth,FitHeight)' > ;
//  create by sl 
// ---------------------------------------------------
function ImgAutoSize(imgD,FitWidth,FitHeight) 
{
var image1=new Image(); 
image1.onload = function ()
{
    if(this.width>0 && this.height>0) 
    { 
        if(this.width/this.height>= FitWidth/FitHeight) 
        { 
            if(this.width>FitWidth) 
            { 
                imgD.width=FitWidth; 
                imgD.height=(this.height*FitWidth)/this.width; 
            } 
            else 
            { 
                imgD.width=this.width; 
                imgD.height=this.height; 
            } 
        } 
        else 
        { 
            if(this.height>FitHeight) 
            { 
                imgD.height=FitHeight; 
                imgD.width=(this.width*FitHeight)/this.height; 
            } 
            else 
            { 
                imgD.width=this.width; 
                imgD.height=this.height; 
            } 
        } 
    }
    image1 = null;
}

image1.src=imgD.src; 
imgD.style.cursor = 'hand';
imgD.onclick= function(){openWin(this.src,'imgphoto',600,400)};
imgD.title = "點擊在新窗口中查看原圖";
}

相關(guān)文章

最新評論