天天看點

神奇的代碼——JavaScript在浏覽器中的妙用

  現精心從網上淘了一些有價值的javascript代碼,有興趣的可以試試。方法:将給出的代碼複制到浏覽器位址欄(如果你夠笨,那你就對照着一個字元一個字元的敲吧,我暈~~)然後回車就行了。

        1.在任意網站上随意塗鴉

       javascript:document.body.contenteditable='true'; document.designmode='on'; void(0)

        這是一段神奇的代碼,利用此代碼黑掉google、baidu……簡直就是舉手之勞啊!隻要你在ie浏覽器任意打開一個網站,然後在浏覽器上輸入前面這段代碼然後回車,你就可以随心所欲的修改這個網站啦!想想google的頁面被自己改得面目全非,是不是過足了黑客瘾啊!

       輸入如下代碼,将退出編輯狀态:javascript:document.body.contenteditable='false';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; dis.top=math.cos(r*y1+i*y2+y3)*y4+y5}r++}setinterval('a()',5);void(0);

        3.解除右健鎖定

        javascript:functiondocument.oncontextmenu(){return true;} function document.onselectstart(){returntrue;} function document.onsdragstart(){return true;}

        4.顯示網頁中的所有圖檔

       javascript:ai7mg6p='';for%20(i7m1bqz=0;i7m1bqz<document.images.length;i7m1bqz++){ai7mg6p+='<img%20src='+document.images[i7m1bqz].src+'><br>'};if(ai7mg6p!=''){document.write('<center>'+ai7mg6p+'</center>');void(document.close())}else{alert('no%20images!')}

        5.顯示網頁中除圖檔的其他

       javascript:for(jk6bvw=0;jk6bvw<document.images.length;jk6bvw++){void(document.images[jk6bvw].style.visibility='hidden')}

        6.顯示網頁源代碼(對于加密過的可以直接顯示其加密前的源代碼)

       javascript:s=document.documentelement.outerhtml;document.write('<body></body>');document.body.innertext=s;

        7.網頁放大1.5倍

       javascript:void(s=document.body.style);void(z=s.getattribute('zoom'));if(z){s.setattribute('zoom',(parseint(z)+50)+'%');}elses.setattribute('zoom','150%')

        8.網頁縮小0.5倍

       javascript:void(s=document.body.style);void(z=s.getattribute('zoom'));if(z){s.setattribute('zoom',(parseint(z)-50)+'%');}elses.setattribute('zoom','50%')

        9.把隐藏的表單顯示出來

       javascript:for(i=0;i<document.all.length;i++){document.body.all[i].maxlength=2147483647;document.body.all[i].outerhtml=document.body.all[i].outerhtml.replace(/type=(radio)|(hidden)|(checkbox)/i,'type=text');}void(0)

再發一些javascript和html5結合起來實作的絢麗效果。

3d玫瑰

<a href="http://www.csdn.net/article/2012-02-09/311621">http://www.csdn.net/article/2012-02-09/311621</a>

3d聖誕樹

<a href="http://www.csdn.net/article/2010-12-24/286274">http://www.csdn.net/article/2010-12-24/286274</a>

3d小蜜蜂

<a href="http://www.lupaworld.com/article-223032-1.html">http://www.lupaworld.com/article-223032-1.html</a>

more

<a href="http://js1k.com/2010-xmas/demos">http://js1k.com/2010-xmas/demos</a>

繼續閱讀