We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
What am i doing wrong?
Topic Started: Jan 30 2007, 06:21 PM (319 Views)
jarocks
Member Avatar
Gods don't need a title.
[ *  *  * ]
Code:
 
<html>
<head>
<title>javascript guessing game</title>
<script type="text/javascript">

function check(guess2,number)
if (guess2==number)
 return true
else
 return false
}

function guess(){
var guess1 = parseInt(window.prompt("Guess The Number Between 1 and 10",""))
return guess1
}

function game(){
var guesses = new Array()
var number=3
var i=1
for (i=1;i<=5;i++)
{

if(check(guess(),number)){break}
document.write("wrong<br />")
}

document.write("correct<br />")

}
</script>
</head>
<body>
<a href="javascript:game()">Guessing Game</a>
</body>
</html>

what am i doing wrong?
Offline Profile Quote Post Goto Top
 
Larksmann
Member Avatar
5 Meters Up and Inverted
[ *  *  * ]
Missing { before function body:
Code:
 
function check(guess2,number)
if (guess2==number)
return true
else
return false
}
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply