How to use Confirm box in JavaScript

Confirm box in Javascript

Confirmation javascript used to confirm an important actions that are taking place on a website. For example, they may be used to confirm an order submission or logout from the website, change the login password we confirm that action before they done..

JavaScript 
confirm box pops up, the user will have two option  OK or Cancel.

If clicks “OK”, means true. If clicks “Cancel”, means false
<html>
<head>
<script type=”text/javascript”>
function show()

{
var  mm=confirm(“Click Button!”);
if (mm==true)
{            alert(“OK!”);
}
else
{
alert(“Cancel!”);
}
}

</script>
</head>
<body>
<input type=”button” onclick=”show()” value=”show alert box” />
</body>
</html>

* Below Screen showing coding of JavaScript Confirm Box.


 
* Below screen Display the Confirm box
* Confirm box have two options OK OR Cancel.

I hope this confirm Javascript will  help you……

Leave a Reply

Your email address will not be published. Required fields are marked *