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
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
Offline
rufflebee wrote:
Life has bad words in it
its true
Offline
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
![]()
So?
Offline
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
![]()
So?
So some people like to hide from the real world. Stop being so insensitive. jk

Offline
OK, I deleted the post I made, go and google "javascript random message" yourself.
Offline
Back on topic please
Offline
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)
Offline
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.
Offline