OK, to start with let's get rid of your syntax errors:
- Your function name was not valid.
- You were missing a '{' at the beginning of the first IF statement.
- I know that you don't have end each line with a semicolon, but it's good programming practice to do so.
So, here is your corrected code:
- HTML: Select all
<html>
<head></head>
<title>Guess your interger</title>
<script language = "javascript">
function Guess() {
var highnum=1000;
var lownum=0;
var guess =(lownum+highnum)/2;
var count=0;
if (myform.High.Checked) {
highnum=guess;
}
if (myform.Low.Checked){
lownum=guess;
}
guess=(lownum+highnum)/2;
count++;
myform.guessbox.value=guess;
myform.counter.value=guess;
}
</script>
<body>
<H1><bold><center> Guess Your Integer</h1>
<h3> Think of an interger between 1and 100(Don't tell anyone!)<br>
The computer will guess you number in ten guesses or less<br><br><br>
Check high checkbox if our guess was to high
<br>
Check Low checkbox if our guess was to low
<br>
Press Guess button to start game.
<br>
<br>
<br>
<Form name = "myform">
<input type="button" value="Guess"onclick="Guess()">
<p>Low<INPUT TYPE = "Checkbox" name = "Low">
<p>High<INPUT TYPE = "Checkbox" name = "High">
<p>Our guess is<input name = "guessbox" type="text">
<p>We have made<input name= "counter" size="8">Guesses
</form>
</head>
</body>
Your next problem is that you have a bunch of logic errors. The way this page is written right now, it won't work... I'm not going to write this one for you, but I'll give you some hints:
- the highnum, lownum, count, and guess variables need to be declared and initialized outside of the Guess() function.
- the value of the 'counter' input box should be "counter" and not "guess"

.
Good Luck and if you really get stumped, feel free to ask some more questions.
