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

#1 2011-04-28 19:32:49

-iNetMaster-
Scratcher
Registered: 2010-08-30
Posts: 1000+

Can someone help me?

I need something for my website, preferably HTML, and I want it to say a new tip every time you refresh the page or go to the site.

Can someone help?

Offline

 

#2 2011-04-28 19:43:28

kimmy123
Scratcher
Registered: 2008-05-20
Posts: 1000+

Re: Can someone help me?

archmage wrote:

http://www.javascriptkit.com/script/cut15.shtml

You can't do that with HTML since it doesn't generate random numbers. HTML code is mainly for displaying pages not generating dynamic content.

That has a bad word in it  hmm


http://i.imgur.com/Mg3TPIE.pnghttp://i.imgur.com/rgyzXV5.pnghttp://i.imgur.com/685FKVd.pnghttp://24.media.tumblr.com/8678e33865664f328e1654109679cb92/tumblr_mm1qu3jGD71s8caito3_r1_250.gif

Offline

 

#3 2011-04-28 19:44:33

rufflebee
Scratcher
Registered: 2008-10-15
Posts: 1000+

Re: Can someone help me?

Life has bad words in it


http://i44.tinypic.com/34e9cab.png

Offline

 

#4 2011-04-28 19:45:15

puppetadventurer
Scratcher
Registered: 2011-02-20
Posts: 1000+

Re: Can someone help me?

rufflebee wrote:

Life has bad words in it

its true


3

Offline

 

#5 2011-04-28 19:46:04

SpriteMaster
Scratcher
Registered: 2009-01-25
Posts: 1000+

Re: Can someone help me?

kimmy123 wrote:

archmage wrote:

http://www.javascriptkit.com/script/cut15.shtml

You can't do that with HTML since it doesn't generate random numbers. HTML code is mainly for displaying pages not generating dynamic content.

That has a bad word in it  hmm

So?


`                        Click here for my YouTube channel!                        `http://i.imgur.com/4Qz3I.jpg

Offline

 

#6 2011-04-28 19:54:44

echs
Scratcher
Registered: 2010-03-18
Posts: 1000+

Re: Can someone help me?

SpriteMaster wrote:

kimmy123 wrote:

archmage wrote:

http://www.javascriptkit.com/script/cut15.shtml

You can't do that with HTML since it doesn't generate random numbers. HTML code is mainly for displaying pages not generating dynamic content.

That has a bad word in it  hmm

So?

So some people like to hide from the real world. Stop being so insensitive. jk


http://i45.tinypic.com/35m4llw.gif

Offline

 

#7 2011-04-28 20:04:26

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Can someone help me?

OK, I deleted the post I made, go and google "javascript random message" yourself.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#8 2011-04-28 20:10:03

kimmy123
Scratcher
Registered: 2008-05-20
Posts: 1000+

Re: Can someone help me?

archmage wrote:

OK, I deleted the post I made, go and google "javascript random message" yourself.

But it's still in our posts  tongue


http://i.imgur.com/Mg3TPIE.pnghttp://i.imgur.com/rgyzXV5.pnghttp://i.imgur.com/685FKVd.pnghttp://24.media.tumblr.com/8678e33865664f328e1654109679cb92/tumblr_mm1qu3jGD71s8caito3_r1_250.gif

Offline

 

#9 2011-04-28 20:11:03

kimmy123
Scratcher
Registered: 2008-05-20
Posts: 1000+

Re: Can someone help me?

echs wrote:

SpriteMaster wrote:

kimmy123 wrote:

That has a bad word in it  hmm

So?

So some people like to hide from the real world. Stop being so insensitive. jk

Mean.

even with the gainsboro text.


http://i.imgur.com/Mg3TPIE.pnghttp://i.imgur.com/rgyzXV5.pnghttp://i.imgur.com/685FKVd.pnghttp://24.media.tumblr.com/8678e33865664f328e1654109679cb92/tumblr_mm1qu3jGD71s8caito3_r1_250.gif

Offline

 

#10 2011-04-28 20:36:34

-iNetMaster-
Scratcher
Registered: 2010-08-30
Posts: 1000+

Re: Can someone help me?

Back on topic please

Offline

 

#11 2011-04-28 21:35:54

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Can someone help me?

In head tag:

<SCRIPT TYPE="text/javascript">
function MoreGamesNow()
{
var x = (Math.floor(Math.random()*4) )  +1
if(x==1)
{
alert("Welcome");
}
else if(x==2)
{
alert("Nice to meet you")
}
else if(x==3)
{
alert("Etcetera")
}
else if(x==4)
{
alert("You get the idea")
}
}
</SCRIPT>



In Body Tag:
<BODY onLoad="MoreGamesNow();">

Last edited by MoreGamesNow (2011-04-28 21:36:06)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#12 2011-04-28 21:38:00

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Can someone help me?

var x = (Math.floor(Math.random()*4) )  +1

Change the 4 to change the number of options (e.g. a 5 would give you 5 options, a 3 would give you 3 options)

What the code does:

Declares a variable (x), sets the variable to a random number between 1 and 4, and runs the result through an if-else-else-else-else... statement.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer