Use switch with true false value : Switch « Language Basics « JavaScript DHTML
- JavaScript DHTML
- Language Basics
- Switch
Use switch with true false value
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
var yourchoice;
yourchoice = confirm("True of false")
switch (yourchoice)
{
case true:
alert("true!");
break;
case false:
alert("false");
break;
}
</script>
</head>
<body>
</body>
</html>
Related examples in the same category