If we want to get the JavaScript confirmation message on click of a button or link, we can use following code.
<span onclick="return confirm('Are you sure to DELETE the record?')">
<a href="gotothispage.aspx?delete=12" title="Delete">Delete</a>
</span>
In place of anchor tag highlighted above, we can place asp.net button, link button, html buttons or any other controls etc. confirm("xxxxx") function returns true if clicked OK button else it returns false, so you can also store its value into a javascript variable like.
var returnValue = confirm("Are you sure?");
if user clicks OK button in the confirmation box, returnValue will have true otherwise false.