我的Blog我做主^_^

          走向一條通往JAVA的不歸路...

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            64 隨筆 :: 68 文章 :: 77 評論 :: 0 Trackbacks
          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
          <HTML><HEAD>
          <TITLE>JavaScript自動生成圖片縮略圖及預覽圖</TITLE>
          <Script language="JavaScript">
          <!--
          //*******************************************
          //**代碼功能:自動將對象內所有圖片按比例縮放*****
          //**對象內所有圖片及預覽原圖禁止右鍵功能*******
          //**對象內所有經(jīng)過縮小的圖片在本窗口內預覽原圖**
          //**作者:逍遙居士,時間:2006年12月14日*******
          //**網(wǎng)址:http://www.iered.com****************
          //**申明:可以轉載,但請保留此版權信息**********
          //*******************************************
          function killErrors(){return true;}?
          window.onerror = killErrors;
          function getElementById(id)
          ? {
          ??? if (typeof(id) != "string" || id == "") return null;
          ??? if (document.getElementById) return document.getElementById(id);
          ??? if (document.all) return document.all(id);
          ??? try {return eval(id);} catch(e){ return null;}
          ? }
          function getMousexy(x)
          {if (document.layers) getMouseLoc;
          ? else if (document.all) getMouseLoc();
          if (x) return mouseLocation.x;
          ? else return mouseLocation.y;
          }
          function Point(x,y) {? this.x = x; this.y = y; }
          mouseLocation = new Point(-500,-500);
          function getMouseLoc(e)
          {if(!document.all)
          ? {mouseLocation.x = e.pageX;mouseLocation.y = e.pageY;}
          ? else
          ? {mouseLocation.x = event.x + document.body.scrollLeft;mouseLocation.y = event.y + document.body.scrollTop;}
          ? return true;
          }
          if(document.layers){document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc;}
          //MouseXyEnd
          function getImgName(ims)
          {var reName;
          if (ims.lastIndexOf("/")==-1) reName = "Error";
          else reName = ims.substring(ims.lastIndexOf("/")+1);
          return reName.toUpperCase();
          }
          function stopImg(){return false;}
          function HiddenImg()
          {getElementById("sImg").style.visibility="hidden";
          getElementById("sImg").style.display="none";
          }
          function ShowImg()
          {var Im = window.event.srcElement;
          var iName=Im.name.split("_");
          var iws=iName[0],ihs=parseInt(iName[1])+20;
          getElementById("ImgName").innerHTML=getImgName(Im.src)+"&nbsp;";
          getElementById("sImgs").src=Im.src;
          getElementById("sImgs").alt=getImgName(Im.src);
          getElementById("sImgs").width=iws;
          getElementById("sImg").style.left=getMousexy(true)+"px";
          getElementById("sImg").style.top=getMousexy(false)+"px";
          getElementById("sImg").style.width=iws+"px";
          getElementById("sImgs").height=ihs;
          getElementById("sImg").style.height=ihs+"px";
          getElementById("sImg").style.visibility="visible";
          getElementById("sImg").style.display="block";
          }
          function FormatImg(divid,iw,ih)
          {
          ? var Img,m,wh;
          ? m=getElementById(divid).getElementsByTagName("IMG");
          ? for (var i=0; i<m.length; i++)
          ? {Img=new Image(),Img.src=m[i].src;
          ?wh=Img.width/Img.height;
          ?m[i].name=m[i].id=Img.width+"_"+Img.height+"_"+i;
          ?m[i].style.cursor="hand";
          ?m[i].alt=unescape("%u70B9%u51FB%u770B%u5927%u56FE%uFF01");
          ? m.item(i).attachEvent("onclick", ShowImg);
          ? m.item(i).attachEvent("oncontextmenu", stopImg);
          ? m.item(i).attachEvent("onselectstart", stopImg);
          ? m.item(i).attachEvent("ondragstart", stopImg);
          ? if (Img.width>Img.height){
          ? if (Img.width>=iw){
          ? m[i].width=iw;
          ? m[i].height=parseInt(iw/wh);}
          ? }
          ? else{
          ? if (Img.height>=ih){
          ? m[i].width=parseInt(ih*wh);
          ? m[i].height=ih;}
          ? }
          ? }
          }
          document.writeln("<div id=\"sImg\" style=\"z-index: 9999; left: 20px; visibility: hidden; width: 180px; position: absolute; top: 50px; height: 80px;display:none;\" oncontextmenu=\"return false\" onselectstart=\"return false\" ondragstart=\"return false\">");
          document.writeln("<TABLE style=\"width: 100%; position: absolute; height:100%;\" cellSpacing=\"2\" cellPadding=\"0\" border=\"1\" bgcolor=\"#009966\"><TBODY>");
          document.writeln("<TR height=\"20\"><TD align=\"center\">");
          document.writeln("<table style=\"width: 100%;height:100%;\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\"><tr><td align=\"left\">&nbsp;<a href=\"JavaScript:HiddenImg()\" style=\"color:#FFFFFF; font-weight:bold;text-decoration:none;font-size:12px;\">關閉窗口<\/a><\/td>");
          document.writeln("<td align=\"right\" id=\"ImgName\" style=\"color:#FFFFFF; font-weight:bold;font-size:12px;\"><\/td><\/tr></table><\/TD><\/TR>");
          document.writeln("<TR>");
          document.writeln("<TD align=\"center\">");
          document.writeln("<img alt=\"\" src=\"\" align=\"absmiddle\" id=\"sImgs\" border=\"0\"><\/TD><\/TR>");
          document.writeln("<\/TBODY><\/TABLE><\/DIV>");
          //-->
          </Script></HEAD><BODY>
          <div id="article">
          <img src="<BR>
          <img src="
          </div>
          <Script language="JavaScript">
          FormatImg('article',300,260);
          //FormatImg(對象ID,允許圖片的最大寬度,允許圖片的最大高度);
          //也可以<BODY onLoad="FormatImg('article',300,260)">
          </Script><BR>
          <a href="
          </BODY></HTML>

          主站蜘蛛池模板: 东城区| 黔东| 外汇| 云梦县| 金门县| 玛多县| 靖州| 永清县| 武川县| 成安县| 广水市| 荥经县| 沐川县| 许昌市| 翁牛特旗| 沽源县| 太谷县| 惠州市| 中牟县| 错那县| 原平市| 老河口市| SHOW| 永顺县| 通道| 台安县| 建昌县| 资兴市| 宝兴县| 绥江县| 乌海市| 乾安县| 泰兴市| 福贡县| 加查县| 北碚区| 郸城县| 连平县| 甘南县| 上栗县| 常熟市|