Fun with Javascript


1. Browse to a site like Amazon.

2. Enter the following into your browser address window

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. Hit Enter and watch the weirdness.

, ,

  1. #1 by Ali on September 15, 2007 - 4:12 am

    That is too weird! Why does that happen?

  2. #2 by Peter on September 17, 2007 - 6:14 am

    Nifty!

  3. #3 by Doc Feucht on October 1, 2007 - 4:41 pm

    Far freakin’ out. Just too cool. Did you write that?

  4. #4 by Dave Feucht on November 6, 2007 - 3:36 pm

    Heh, nice – it just grabs the list of images on the page and manipulates their positioning on the page using style attributes, so they swirl around.

    ah, it’s just like those wonderful sites that have banner images following your mouse all over the page! šŸ™‚

(will not be published)