<?xml version="1.0" encoding="gbk"?> <rss version="2.0"><channel> <title>定阅帖子更新-BBS.OKHY.COM</title> <link>http://bbs.okhy.com/XML.ASP</link><description>海盐论坛 - 海盐论坛</description> <copyright>TEAM 1.0.1</copyright><generator>OKHY.COM BBS</generator> <item><link>http://bbs.okhy.com/Showpost.asp?id=13584 </link><title><![CDATA[有趣的浏览器地址栏Javascript代码]]></title><author>APOLLO</author><pubDate>2008-11-24 19:51:23</pubDate><description><![CDATA[<P>&nbsp;&nbsp;&nbsp; <STRONG>1、自由编辑网页</STRONG></P><P>&nbsp;&nbsp;&nbsp; 在地址栏输入下面的代码按enter，网页上所有元素都能变成可编辑状态，你可以移动、调整元素大小。</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><I>javascript</I>:document.body.contentEditable=&#39;true&#39;;document.designMode=&#39;on&#39;; void 0</TD></TR></TBODY></TABLE><BR></P><P>&nbsp; 编辑完还可以返回非编辑状态。</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><I>javascript</I>:document.body.contentEditable=&#39;false&#39;;document.designMode=&#39;off&#39;; void 0</TD></TR></TBODY></TABLE><BR>&nbsp;&nbsp;&nbsp; 这是经我重新编辑的google.cn，如图1：<BR><BR><TABLE align=center><TBODY><TR><TD><IMG alt=图1 src="http://publish.it168.com/2008/0722/images/1090689.JPG" border=1></TD></TR><TR><TD align=middle>图1 自由编辑网页元素</TD></TR></TBODY></TABLE></P><P>&nbsp;&nbsp;&nbsp; <STRONG>2、无敌风火轮</STRONG></P><P>&nbsp;&nbsp;&nbsp; 在地址栏运行下面的代码可使页面上所有图片元素一个接一个地转圈。这种效果最好的实现地方就是图片搜索了，如图2：</P><P><TABLE align=center><TBODY><TR><TD><IMG alt=图2 src="http://publish.it168.com/2008/0722/images/1090691.JPG" border=1></TD></TR><TR><TD align=middle>图2 实现网页图片转圈</TD></TR></TBODY></TABLE></P><P>&nbsp;&nbsp;&nbsp; 改变代码里的“img”成任何网页上有的字符，可以使这些字符做无敌风火轮运动。</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><P><I>javascript</I>:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=&#39;absolute&#39;; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval(&#39;A()&#39;,5); void(0);</P></TD></TR></TBODY></TABLE></P><P>&nbsp;&nbsp;&nbsp; <STRONG>3、晃来晃去</STRONG></P><P>&nbsp;&nbsp;&nbsp; 不但是你，浏览器也不是那么喜欢这个javascript。在地址栏运行这个代码后，浏览器会迅速地晃来晃去。代码如下：</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><P><I>javascript</I>:function flood(n) {if (self.moveBy) {for (i = 200; i &amp;gt; 0;i--){for (j = n; j &amp;gt; 0; j--) {self.moveBy(1,i); self.moveBy(i,0);self.moveBy(0,-i); self.moveBy(-i,0); } } }}flood(6);{ var inp = "D-X !msagro na dah tsuj resworb rouY"; var outp = ""; for (i = 0; i &amp;lt;= inp.length; i++) {outp =inp.charAt (i) + outp ; } alert(outp) ;}; reverse</P></TD></TR></TBODY></TABLE></P><P>&nbsp;&nbsp;&nbsp; 注：如果这个代码无效，请将"&amp;gt;"改成"&gt;"，"&amp;It;&#39;改成"&lt;"。</P><P>&nbsp;&nbsp;&nbsp; <STRONG>4、<A title=计算器 style="COLOR: #000000" href="http://product.it168.com/list/b/0342_1.shtml" target=_blank>计算器</A></STRONG></P><P>&nbsp;&nbsp;&nbsp; 在地址栏输入下面的代码，可以实现简单的四则运算：</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><I>javascript</I>: alert(34343+3434-222);</TD></TR></TBODY></TABLE></P><P>&nbsp;&nbsp;&nbsp; 事实上这个代码可以继续简化，比如简化成这样：</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><I>javascript</I>: 34343+3434-222</TD></TR></TBODY></TABLE></P><P>&nbsp;&nbsp;&nbsp; <STRONG>5、防钓鱼验证</STRONG></P><P>&nbsp;&nbsp;&nbsp; 某些钓鱼网站提供的URL和网页本身的URL是不一致的，你可以用下面的代码进行验证，当两个URL相差太大的时候，你就要稍加小心了：</P><P><TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=2 width=450 align=center borderColorLight=#cccccc border=1><TBODY><TR><TD style="FONT-SIZE: 9pt" bgColor=#f6f6f6><P><I>javascript</I>:alert("The actual URL is:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + location.protocol + "//" + location.hostname + "/" + "&#92;nThe address URL is:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " + location.href + "&#92;n" + "&#92;n If the server names do not match, this may be a spoof.");</P></TD></TR></TBODY></TABLE></P>&nbsp;&nbsp;&nbsp; 很有趣，不是吗？]]></description></item></channel></rss>