Heim > Web-Frontend > js-Tutorial > Hauptteil

几个有趣的Javascript Hack_javascript技巧

WBOY
Freigeben: 2016-05-16 18:22:30
Original
1065 Leute haben es durchsucht
1. 直接在浏览器中编辑网页内容
复制代码 代码如下:
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.images; 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

如果这个代码无效,请将">"改成">","&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.");
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!