Thursday, January 6, 2011

Seven Javascript Tricks

Here are some javascripts to play with. Just copy and paste them in to the browser address bar and hit "Enter".
Try them out.

01. Let you edit almost any web page:

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


02. Free simple calculator from the browser.

javascript: alert(125*15-12^4); 
(try similar calculations)


03. Shake your Browser, at least once in a while :)

javascript:function Shw(n) {if (self.moveBy) {for (i = 35; 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); } } }} Shw(6) 


04. This will rotate pictures in the page.

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);



05. This is also fun

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6;y3=.24; x4=300; y4=200; x5=300; y5=200; function mixit(){ DI2=document.getElementsByTagName("img"); DIL2=DI2.length; for(j=0; j-DIL; j++){DIS2=DI2[j].style; DIS2.zIndex=200-Math.floor(Math.random()*100+1);} } function A(){DI=document.getElementsByTagName("img"); DIL=DI.length; 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()",50); setInterval("mixit()",800);void(0);



06. This will rotate pictures and links in the page.

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("a"); 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);


07. Find spoof websites

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

No comments:

Post a Comment

E-mail Subscription

Enter your email address:

Delivered by FeedBurner