Re:Code's Worst Enemy
by staticshock on Wednesday December 19, 2007 @10:45PM
(#91388)
in the browser, javascript's REPL is essentially the address bar. you can type in javascript:alert(2+2) to output 4, or javascript:void(code) just to run an expression and swallow the output. to evaluate expressions more complex than a one liner you can inline a function, javascript:alert((function(){var x = 2; return x+x;})()). that's how bookmarklets work.
[ Parent
| on HN ]
Re:Code's Worst Enemy
by michaelneale on Wednesday December 19, 2007 @11:49PM
(#91400)
For a more psychadelic version, try this:
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(Rx1+ix2+x3)x4+x5; DIS.top=Math.cos(Ry1+iy2+y3)y4+y5}R++}setInterval('A()',5); void(0);
(in address bar)
Re:Code's Worst Enemy
by staticshock on Thursday December 20, 2007 @03:57PM
(#91566)
the auto-formatting swallowed the multiplication symbols. the actual code should be this, with "TIMES" replaced by the multiplication symbol. is there any way to escape them?
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 TIMES x1+i TIMES x2+x3) TIMES x4+x5; DIS.top=Math.cos(R TIMES y1+i TIMES y2+y3) TIMES y4+y5}R++};setInterval('A()',5); void(0);
Re:Code's Worst Enemy
by gaby123456789 on Friday May 15, 2009 @05:20PM
(#611382)
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(Rx1+ ix2+x3)* x4+x5; DIS.top=Math. . cos(Ry1+ iy2+y3)* y4+y5}R++ }setInterval( 'A()',5); void(0)