Write a script that plays a "guess the number" game as follows: Your program chooses the number to be guessed by selecting a random integer in the range 1 to 1000. The script displays the prompt Guess a number between 1 and 1000 next to a text field. The player types a first guess into the text field and clicks a button to submit the guess to the script. If the player's guess is incorrect, your program should display Too high. Try again. or Too low. Try again. to help the player "zero in" on the correct answer and should clear the text field so the user can enter the next guess. When the user enters the correct answer, display Congratulations. You guessed the number! and clear the text field so the user can play again.

<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>GuessIt by Wasim</title>
<script type="text/javascript">
<!--
var num = Math.random()*(999)+1;
function Guess()
{
var guess = parseInt(document.getElementById("hint").value);
if (guess < num)
document.getElementById("guesshint").value= "No, guess higher.";
if (guess > num)
document.getElementById("guesshint").value= "No, guess lower.";
if (guess == num)
{
window.alert("Congratulations! You guessed the number");
}
}
}// -->
</script>
</head>
<body>
<h1> Guess It</h1>
<hr />

<p>Press F5 or Refresh to load script again. Guess Number</p>
<form name = "guessform" action = "">
<table border = "1">
<caption>Guess Random Number</caption>
<tr><td>Input Any Number between 1 and 1000</td>
<td><input name = "hint" type = "text" />
</td></tr>
<tr><td>Hint</td>
<td><input name = "guesshint" type = "text" disabled="disabled" />
</td></tr>
<tr><td><input type = "button" value = "Calculate" onclick= "Guess()"/></td></tr>
</table>
</form>
</body>
</html>