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>