65.9K
CodeProject 正在变化。 阅读更多。
Home

根据图像大小弹出

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.12/5 (5投票s)

2007 年 3 月 17 日

viewsIcon

29058

downloadIcon

211

根据图像大小弹出:将图像放入文件夹,并给出图像和文件夹的名称和路径

Screenshot - ImagePopUp.jpg

引言

文章将根据图像的大小自动打开弹出窗口

背景

本文的背景是,我正在为客户工作,需要根据客户端图像的大小打开我的弹出窗口。

使用代码

要使用本文,用户需要下载 zip 文件,并将其解压缩到磁盘上的任何位置。双击 abc.htm 并单击图像链接。

代码块应设置为“Formatted”样式,如下所示

//Code
// <script language="Javascript">
   function PopupPic(sPicURL) {
     window.open( "popup.htm?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200");
   }
   </script>
 <script language='javascript'>
   var arrTemp=self.location.href.split("?");
   var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
   var NS = (navigator.appName=="Netscape")?true:false;

     function FitPic() {
       iWidth = (NS)?window.innerWidth:document.body.clientWidth;
       iHeight = (NS)?window.innerHeight:document.body.clientHeight;
       iWidth = document.images[0].width - iWidth;
       iHeight = document.images[0].height - iHeight;
       window.resizeBy(iWidth, iHeight);
       self.focus();
     };
 </script>
//

关注点

一个有趣的观点是,JavaScript 可以完成我们在 Web 上需要的一切。

历史

我正在为客户工作,需要根据客户端图像的大小打开我的弹出窗口。

© . All rights reserved.