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 *

9 + 5 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">