当前位置: 首页 > 图文教程 > 网络编程 > Javascript > IE地址栏实现的JS有趣效果和应用

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 IE地址栏实现的JS有趣效果和应用


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 313 ::
收藏到网摘: n/a

这篇分享几个在地址栏实现的Javascript有趣效果和应用。能在浏览器地址栏实现的效果太多了,字体放大、显示所有图片、显示Cookie等等。但这篇文章重点放在“有趣”上面,当你无聊的时候,不妨玩玩。

1、编辑网页

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

代码如下:

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

2、无敌风火轮

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

代码如下:

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(”img”); 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)+”px”; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+”px”}R++}setInterval(’A()’,5); void(0);

3、晃来晃去

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

javascript:function flood(n) {if (self.moveBy) {for (i = 200; i > 0;i–){for (j = n; j > 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 <= inp.length; i++) {outp =inp.charAt (i) + outp ; } alert(outp) ;}; reverse

如果这个代码无效,请将”&gt;”改成”>”,”&It;’改成”<”。

4、计算器

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

javascript: alert(34343+3434-222);

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

javascript: 34343+3434-222

5、防钓鱼验证

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

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

很有趣,是吧?