Confirms an action with the user then alerts them their choice.

<script type="text/javascript">

if (confirm("Choose OK or Cancel.")) {

  alert("OK");

} else {

  alert("Cancel");

}

</script>