欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

新頁面打開實(shí)際尺寸的圖片

 更新時(shí)間:2006年08月25日 00:00:00   作者:  
復(fù)制代碼 代碼如下:

<script language="JavaScript" type="text/JavaScript">
<!--
var imgObj;
function checkImg(theURL,winName){
  if (typeof(imgObj) == "object"){
    // 是否已取得了圖像的高度和寬度
    if ((imgObj.width != 0) && (imgObj.height != 0))
      // 根據(jù)取得的圖像高度和寬度設(shè)置彈出窗口的高度與寬度,并打開該窗口
      // 其中的增量 20 和 30 是設(shè)置的窗口邊框與圖片間的間隔量
      OpenFullSizeWindow(theURL,winName, ",width=" + (imgObj.width+20) + ",height=" + (imgObj.height+30));
    else
      // 因?yàn)橥ㄟ^ Image 對(duì)象動(dòng)態(tài)裝載圖片,不可能立即得到圖片的寬度和高度,所以每隔100毫秒重復(fù)調(diào)用檢查
      setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
  }
}

function OpenFullSizeWindow(theURL,winName,features) {
  var aNewWin, sBaseCmd;
  // 彈出窗口外觀參數(shù)
  sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,";
  // 調(diào)用是否來自 checkImg 
  if (features == null || features == ""){
    // 創(chuàng)建圖像對(duì)象
    imgObj = new Image();
    // 設(shè)置圖像源
    imgObj.src = theURL;
    // 開始獲取圖像大小
    checkImg(theURL, winName)
  }
  else{
    // 打開窗口
    aNewWin = window.open(theURL,winName, sBaseCmd + features);
    // 聚焦窗口
    aNewWin.focus();
  }
}
//-->
</script>


使用時(shí)將上面的代碼放在網(wǎng)頁文檔的<head></head>標(biāo)記對(duì)中,然后在鏈接的點(diǎn)擊事件中調(diào)用OpenFullSizeWindow函數(shù),如<a href="fullsize.jpg" onClick="OpenFullSizeWindow(this.href,'','');return false"><img src="small.jpg"></a>即可

相關(guān)文章

最新評(píng)論