crazyeyez51
08-18-2007, 09:29 PM
I need help with a program Im trying to write. This program is a three guess program, guessing numbers between 1-10 having three guesses and telling you higher or lewer then after the third time says sorry the correct answer is (num) I have this so far
<html>
<head>
<title>Guess Number Three Times</title>
<script language ="Javascript">
<!--
function makeGuess(num)
{var guess = parseInt(prompt('Guess number from 1 to 10',' '));
if(guess == num) alert('Correct!');
esle (guess < num) alert('The number is more than' + num);
esle if (guess > num) alert('The number is less than' + num);
esle alert('Sorry wrong guess it was' + num);
}//end makeGuess
//-->
</script>
</head>
<body>
<center>
<h1>Guess The Right Number</h1>
<h2>Welcome to the guessing game!</h2>
<h3>Guess a Number between 1 and 10</h3>
</center>
<script language = "javascript">
<!--
var num = (Math.floor(Math.random()*10))+1;//rolldice
//-->
</script>
<center>
<input type="button"
value="Make a Guess"
onClick="makeGuess(num)">
</center>
</body>
</html>
<html>
<head>
<title>Guess Number Three Times</title>
<script language ="Javascript">
<!--
function makeGuess(num)
{var guess = parseInt(prompt('Guess number from 1 to 10',' '));
if(guess == num) alert('Correct!');
esle (guess < num) alert('The number is more than' + num);
esle if (guess > num) alert('The number is less than' + num);
esle alert('Sorry wrong guess it was' + num);
}//end makeGuess
//-->
</script>
</head>
<body>
<center>
<h1>Guess The Right Number</h1>
<h2>Welcome to the guessing game!</h2>
<h3>Guess a Number between 1 and 10</h3>
</center>
<script language = "javascript">
<!--
var num = (Math.floor(Math.random()*10))+1;//rolldice
//-->
</script>
<center>
<input type="button"
value="Make a Guess"
onClick="makeGuess(num)">
</center>
</body>
</html>