<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="5个有趣的浏览器地址栏JavaScript代码">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">admin</a><br />时间:2008-10-28 14:49<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">电脑技术</a><br />内容:
5个有趣的浏览器地址栏JavaScript代码


1、编辑网页

在地址栏输入下面的代码按enter，网页上所有元素都能变成可编辑状态，你可以移动、调整元素大小。如果你只是讨厌某个网站想发泄一下，我建议你使用NetDisater。

代码如下：






javascript:document.body.contentEditable='true'; document.designMode='on'; void 0




这是经我重新编辑的google.cn：



2、无敌风火轮

在地址栏运行下面的代码可使页面上所有图片元素一个接一个地转圈。

这种效果最好的实现地方就是图片搜索了：



改变代码里的&ldquo;img&rdquo;成任何网页上有的字符，可以使这些字符做无敌风火轮运动。

代码如下：






javascript: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(&quot;img&quot;); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+&quot;px&quot;; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+&quot;px&quot;}R++}setInterval('A()',5); void(0);




3、晃来晃去

不但是你，浏览器也不是那么喜欢这个javascript。在地址栏运行这个代码后，浏览器会迅速地晃来晃去。代码如下：






javascript:function flood(n) {if (self.moveBy) {for (i = 200; i &gt; 0;i--){for (j = n; j &gt; 0; j--) {self.moveBy(1,i); self.moveBy(i,0);self.moveBy(0,-i); self.moveBy(-i,0); } } }}flood(6);{ var inp = &quot;D-X !msagro na dah tsuj resworb rouY&quot;; var outp = &quot;&quot;; for (i = 0; i &lt;= inp.length; i++) {outp =inp.charAt (i) + outp ; } alert(outp) ;}; reverse




如果这个代码无效，请将&quot;&gt;&quot;改成&quot;&gt;&quot;，&quot;&amp;It;'改成&quot;&lt;&quot;。

4、计算器

在地址栏输入下面的代码，可以实现简单的四则运算：






javascript: alert(34343+3434-222);




事实上这个代码可以继续简化，比如简化成这样：






javascript: 34343+3434-222




5、防钓鱼验证

某些钓鱼网站提供的URL和网页本身的URL是不一致的，你可以用下面的代码进行验证，当两个URL相差太大的时候，你就要稍加小心了：






javascript:alert(&quot;The actual URL is:tt&quot; + location.protocol + &quot;//&quot; + location.hostname + &quot;/&quot; + &quot;nThe address URL is:tt&quot; + location.href + &quot;n&quot; + &quot;nIf the server names do not match, this may be a spoof.&quot;);




很有趣，不是吗？

</p><p>
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
