topical media & game development
basic-javascript-03-ch3-examp3.htm / htm
<html>
<body>
<script language="JavaScript" type="text/javascript">
var secretNumber = prompt("Pick a number between 1 and 5:", "");
secretNumber = parseInt(secretNumber);
switch (secretNumber)
{
case 1:
document.write("Too low!");
break;
case 2:
document.write("Too low!");
break;
case 3:
document.write("You guessed the secret number!");
break;
case 4:
document.write("Too high!");
break;
case 5:
document.write("Too high!");
break;
default:
document.write("You did not enter a number between 1 and 5.");
break;
}
document.write("<BR>Execution continues here");
</script>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.