This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-07-01 21:07:27

terminator68
Scratcher
Registered: 2008-02-26
Posts: 1000+

Cool Javascript Tricks

Many of you may know the "edit the page" code, but there is way more to that. Paste the following codes into your URL bar, then press enter!
CREDITS:
Page Spin code: hmnwilson
------------------------------------------
1) Edit Page code: javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

2) Page Spin code: javascript:x=0;e=document.body;e.style.position="absolute";function rt(){e.style.top=100-(50*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(50*Math.sin(x*Math.PI/180))+"px";x+=5}; setInterval("rt()",50);void(0)

3) Super Page Spin code: javascript:x=0;e=document.body;e.style.position="absolute";function rt(){e.style.top=100-(500*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(500*Math.sin(x*Math.PI/180))+"px";x+=5}; setInterval("rt()",50);void(0)

4) Picture Spin at top of the page code: 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);

Try 'em all, and post new ones if you have them!

Last edited by terminator68 (2010-07-01 21:14:44)


--------------------Scratcher since '08--------------------
http://images1.wikia.nocookie.net/__cb20110314152018/mlpfanart/images/5/5d/Applejack_chewing.gif

Offline

 

#2 2010-07-01 21:11:19

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: Cool Javascript Tricks

hmnwilson discovered javascript:x=0;e=document.body;e.style.position="absolute";function rt(){e.style.top=100-(50*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(50*Math.sin(x*Math.PI/180))+"px";x+=5}; setInterval("rt()",50);void(0), not me  tongue


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#3 2010-07-01 21:14:23

terminator68
Scratcher
Registered: 2008-02-26
Posts: 1000+

Re: Cool Javascript Tricks

waveOSBeta wrote:

hmnwilson discovered javascript:x=0;e=document.body;e.style.position="absolute";function rt(){e.style.top=100-(50*Math.cos(x*Math.PI/180))+"px";e.style.left=100+(50*Math.sin(x*Math.PI/180))+"px";x+=5}; setInterval("rt()",50);void(0), not me  tongue

Thanks, I'll change that.


--------------------Scratcher since '08--------------------
http://images1.wikia.nocookie.net/__cb20110314152018/mlpfanart/images/5/5d/Applejack_chewing.gif

Offline

 

#4 2010-07-01 21:14:53

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: Cool Javascript Tricks

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


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#5 2010-07-01 21:26:35

Aidan
Scratcher
Registered: 2007-06-15
Posts: 1000+

Re: Cool Javascript Tricks

Number 4 is cool!

Offline

 

#6 2010-07-01 21:33:45

pika100chu
Scratcher
Registered: 2009-07-26
Posts: 500+

Re: Cool Javascript Tricks

Here's a crazy one I made by editing the page spin one:
javascript:x=0;e=document.body;e.style.position="absolute";function rt(){e.style.top=200-(200*Math.cos(x*Math.PI/280))+"px";e.style.left=100+(210*Math.sin(x*Math.PI/180))+"px";x+=5}; setInterval("rt()",50);void(0)

Offline

 

#7 2010-07-02 11:08:59

wmays
Scratcher
Registered: 2008-05-10
Posts: 500+

Re: Cool Javascript Tricks

is it possible to put these in your website in the <head> section?


http://i42.tinypic.com/2z5vcz9.gif
http://phpscripthost.comoj.com/imagescripts/ipimg.php

Offline

 

#8 2010-07-02 12:19:51

terminator68
Scratcher
Registered: 2008-02-26
Posts: 1000+

Re: Cool Javascript Tricks

Aidan wrote:

Number 4 is cool!

I was excited when I found that one  tongue ! It is awesome in google or bing image searches, or on big forum posts here  tongue

wmays wrote:

is it possible to put these in your website in the <head> section?

I don't get what you mean. Could you please explain?

Last edited by terminator68 (2010-07-02 12:22:20)


--------------------Scratcher since '08--------------------
http://images1.wikia.nocookie.net/__cb20110314152018/mlpfanart/images/5/5d/Applejack_chewing.gif

Offline

 

#9 2010-07-03 22:13:05

wmays
Scratcher
Registered: 2008-05-10
Posts: 500+

Re: Cool Javascript Tricks

Can you embed the code in your website?


http://i42.tinypic.com/2z5vcz9.gif
http://phpscripthost.comoj.com/imagescripts/ipimg.php

Offline

 

Board footer