Author |
Message |
Solid_Fire Server Help Squatter
Age:34 Gender: Joined: Dec 22 2004 Posts: 327 Location: NV. Dont stalk me..plz.. Offline
|
Posted: Fri Apr 29, 2005 9:37 pm Post subject: Random Numbers... |
|
|
|
|
Hello...im making a random number generator....just cause...no reason really. But i do have a question...
How would i make it use the first 3 digits out of 7, the beggining of a phone number? (i.e. 246, 888, 882, etc..) and the last 4 digits randomly selected. Here is the code..
<html>
<title>Random Number Picker v0.1</title>
<head><style type="text/css">
.a1{
position:relative;
font-family:Verdana;
font-size:20px;
color:#888888;
}
</style>
<script language="JavaScript">
/*****************************************
* Random Number Generator.(By JPS (initials))
* This notice must stay intact for use.
*****************************************/
var totalnumbers=7 //input total numbers to generate
var lowerbound=1 //input lower bound for each random number
var upperbound=9 //input upper bound for each random number
function lotto(){
B=' ';
RandomNumbers=new Array();
for (i = 1; i <= totalnumbers; i++)
{
RandomNumber = Math.round(lowerbound+Math.random()*(upperbound-lowerbound));
for (j = 1; j <= totalnumbers; j)
{
if (RandomNumber == RandomsNumbers[j])
{
RandomNumber=Math.round(lowerbound+Math.random()*(upperbound-lowerbound));
j=0;
}
j++;
}
RandomsNumbers[i]=RandomNumber;
}
LottoNumbers=RandomNumbers.toString();
X=LottoNumbers.split(',');
for (i=0; i < X.length; i++)
{
X[i]=X[i]+' ';
if (X[i].length==2)
X[i]='0'+X[i];
}
X=X.sort();
for (i=0; i < X.length; i++)
{
OutPut=B+=X[i];
}
if (document.all)document.all.layer1.innerHTML=OutPut;
if (document.getElementById)document.getElementById("layer1").innerHTML=OutPut;
if (document.layers){
document.layers.layer1.document.open();
document.layers.layer1.document.write("<span style='position:absolute;top:0px;left:0px;font-family:Verdana;font-size:20px;color:#888888;text-align:center'> "+OutPut+"</span>");
document.layers.layer1.document.close();
}
T=setTimeout('lotto()',20);
//window.status=OutPut;
}
function StOp(){
setTimeout('clearTimeout(T)',1000);
}
//-->
</script>
</head>
<body><table border='0' width=250 height=50>
<tr valign='middle'>
<td align='center'>
<form name=form>
<input type=button value='Random Number Picker' onClick="lotto();StOp()">
</form>
<span id=layer1 class=a1>Results</span>
</td>
</tr>
</table>
</body> |
Thanks, any help would be great. _________________ Unknown Webmaster, Confused Game Player |
|
Back to top |
|
|
Purge Episode I > Eposide III Jar-Jar is kool
Age:34 Gender: Joined: Sep 08 2004 Posts: 2018 Offline
|
Posted: Fri Apr 29, 2005 10:14 pm Post subject: |
|
|
|
|
Why put it in 'Misc User Apps'? |
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Fri Apr 29, 2005 11:02 pm Post subject: |
|
|
|
|
I dunno, I'm not too hot on js, but that code looked very like a very round-a-bout way of doing it. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
|
Solid_Fire Server Help Squatter
Age:34 Gender: Joined: Dec 22 2004 Posts: 327 Location: NV. Dont stalk me..plz.. Offline
|
Posted: Fri Apr 29, 2005 11:58 pm Post subject: |
|
|
|
|
purge, because it doesnt go in any other catergory ..it has nothin to do with SS.. |
|
Back to top |
|
|
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.
Age:36 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sat Apr 30, 2005 3:50 am Post subject: |
|
|
|
|
Then post it in Trash Talk, heh.
I agree with Cyan, too bad I have no idea how to fix your problem. |
|
Back to top |
|
|
CypherJF I gargle nitroglycerin
Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Sat Apr 30, 2005 11:19 am Post subject: |
|
|
|
|
document.write(""); is your friend. (or is .print lol)... _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
|
|