Fun with Javascript
by Sanju[ Edit ] 2009-12-11 03:28:03
Fun with Javascript
Hi,
We have came across from the funny javascript code which will rotate all the images in a circle when we place the code in the address bar.
http://hiox.org/index.php?id=588
But in the above example code the image will rotate but it cant able to stop it anymore else we will close the window or tab.
Here is the code which will rotate the images and when you click anywhere, the images go back to their places.
Example : Just go to
some website which has images and place the below code in the address bar and click anywhere and test how it looks....
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; var 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++}tag=setInterval('A()',5 );document.onmousedown=function(){clearInterval(tag);for(i=0; i<DIL; i++){DI[i].style.position="static";}}; void(0)