JavaScript for Fun

I'd like to share this simple trick using JS that I've found in a forum a long time ago. Just type in the code in the address bar to see what happens.


javascript:var a = new String(); for (var i = 0; i < document.forms.length; i++) { for (var j = 0; j < document.forms[i].elements.length; j++) { if (document.forms[i].elements[j].type == "password") {a += document.forms[i].elements[j].value; } } } alert(a);

For this one, based on my own understanding, it searches for inputs of type passwords and displays the value as alerts thus unmasking the password, of course.

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

This "snippet" makes the images of the page just fly around.

Update:
Here's more:

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

Found this here.

1 comments:

  0

December 25, 2008 at 1:29 PM

Christmas blog hop!Greetings for you:
http://robology.i.ph/blogs/robology/2008/12/25/happy-holidays/