Make your own free website on Tripod.com

Pick a number between 1 and 10



Source Code


<html>
<head>
<title>Guess a number</title>
<script language="JavaScript">
<!-- Hide --
var p=0;
var c=0;
var d=0;
var wn=0;
var wn1=0;
var wn2=0;
var wn3=0;
function guess(){
p=document.the_form.the_box.value;
document.the_form.the_box.value="";
c=(Math.random());
c=(c*10);
c=Math.round(c);
if (c<1){c=c+2;}
d=p-c;
if (d<0){d=(d*(-1));}
if (d==0){wn++;}
if (d==1){wn1++;}
if (d==2){wn2++;}
if (d>2){wn3++;}
view_res=("Computer picks "+c+"\nYou pick "
+p+"\nDifference "+d);
document.the_form.repo.value=view_res;
view_score=
("Right on "+wn+"\none off "+wn1+"\ntwo off"
+wn2+"\nThe rest "+wn3);
document.the_form.results.value=view_score;
}
// -- End Hide -->
</script>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#9999FF" vlink="#CCCCFF">
<center><h2>Pick a number between 1 and 10</h2>
<form name="the_form">
<textarea name="repo" rows=3 cols=28></textarea><br>
<input type="text" name="the_box" >
<input type="button" name="button"value="submit" onClick=guess()><br>
<textarea name="results" rows=4 cols=28>
</textarea>
</form>
</center>
</body>
</html>

Transload it
Labratory