Okay this is basically what my html script is:
<html>
<head>
<script type"text/javascript">
{
alert ("Let's play a game!")
}
var number = prompt("Guess a number 1-3!");
if (number == "2")
{
alert ("Correct!")
}
else
{
alert ("Wrong, try again?")
}
</script>
</head>
<body>
</body>
</html>
Now what I want to do is if you put in the wrong variable then it would go back to prompt and ask you to guess again. I know that in other languages there ist he goto command, but that doesn't do anything in javascript so it doesn't work.
My question is, is there a command for html that I can use to go back to part of the script?
<html>
<head>
<script type"text/javascript">
{
alert ("Let's play a game!")
}
var number = prompt("Guess a number 1-3!");
if (number == "2")
{
alert ("Correct!")
}
else
{
alert ("Wrong, try again?")
}
</script>
</head>
<body>
</body>
</html>
Now what I want to do is if you put in the wrong variable then it would go back to prompt and ask you to guess again. I know that in other languages there ist he goto command, but that doesn't do anything in javascript so it doesn't work.
My question is, is there a command for html that I can use to go back to part of the script?