Use if statement to check the returning value from a confirm dialog : If « Statement « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
var response = confirm("Do you want to proceed with this book?  Click OK to proceed otherwise click Cancel.");
if ( response == true )
{
    alert("A fine choice!");
}
//  -->
</script>
</head>
<body>

</body>
</html>








3.2.If
3.2.1.Conditionals
3.2.2.if...else
3.2.3.Use if statement to compare the numbers
3.2.4.Use if/else to check the returning value from a confirm dialog
3.2.5.Use if statement to check the returning value from a confirm dialog
3.2.6.Nested if statement
3.2.7.if...then...else...if