The JavaScript confirm function is very similar to the JavaScript alert function. A small dialogue box pops up and appears in front of the web page currently in focus. The confirm box is different from the alert box. It supplies the user with a choice; they can either press OK to confirm the popup's message or they can press cancel and not agree to the popup's request.
Confirmation are most often 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 notify visitors that a link they clicked will take them to another website.
javascript confirm example
Below is an example of how you would use a confirm dialogue box to warn users about something, giving them the option to either continue on or stay put.
<!-- JS-->
<script type="text/javascript">
<!--
function confirmation() {
var answer = confirm("Are your Sure you want to SAVE?")
if (answer){
}
}
//-->
</script>
<!-- HTML CODE -->
<input type="button" name="submit" id="submit" value="Submit" class="button" onClick="return confirmation();" />