The confirm() method displays a dialog box with a specified message, along with an OK and a Cancel button. If the user clicks OK, the confirm method returns true. If the user clicks Cancel, the method returns false.

Confirmation are most often used to confirm an important actions that are taking place on a website.

Example:
<html>
<head>
<script type="text/javascript">
function validate()
{
var result=confirm("Select Ok/Cancel");
if (result==true)
{
alert("OK selected !");
}
else
{
alert("Cancel selected !");
}
}
</script>
</head>
<body>

<input type="button" onclick="validate()" value="Confirm button" />

</body>
</html>