View Full Version : random qoute generator?
Epidemik
11-06-2002, 06:48 PM
I was just wondering where I could find the script that I can put in my site for a random qoute generator which at refresh displays a new qoute. (I have my own qoutes, just need help on the scripting...)
acrobatNerd
11-07-2002, 06:57 AM
try one of these:
Matts script arhive (http://www.scriptarchives.com)
a1javascripts (http://www.a1javascripts.com)
javascript source (http://www.javascriptsource.com)
I think IŽve seen it at javascriptsource.. Try that first!
:moonie:
acrobatNerd
11-08-2002, 06:32 AM
<SCRIPT language="JavaScript">
<!--
function get_random(maxNum)
{
if (Math.random && Math.round)
{
var ranNum= Math.round(Math.random()*(maxNum-1));
ranNum+=1;
return ranNum;
}
else
{
today= new Date();
hours= today.getHours();
mins= today.getMinutes();
secn= today.getSeconds();
if (hours==19)
hours=18;
var ranNum= (((hours+1)*(mins+1)*secn)%maxNum)+1;
return ranNum;
}
}
function getaQuote()
{
var maxQuotes=10;
var whichQuote=get_random(maxQuotes);
whichQuote--;
var quote=new Array(maxQuotes)
quote[0]="Quote #1";
quote[1]="Quote #2";
quote[2]="Quote #3";
quote[3]="Quote #4";
quote[4]="Quote #5";
quote[5]="Quote #6";
quote[6]="Quote #7";
quote[7]="Quote #8";
quote[8]="Quote #9";
quote[9]="Quote #10";
alert(quote[whichQuote]);
}
//-->
</SCRIPT>
<FORM name="form1">
<INPUT TYPE="button" value="Get a Quote!" onClick="getaQuote()">
</FORM>
This script donŽt give you a new quote when site is refreshed, but maybe you can figure that part out yourself... ;)
acrobatNerd
11-08-2002, 06:34 AM
by the way, I found the script at Javascriptcity.com (http://www.hotscripts.com/Detailed/3933.html) .
Maybe youŽll find what you are looking for there.
:)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.