Using "JQuery UI" (a library written in javascript using another library named JQuery) you can use this code:
$('body').append('<div id="yesno_dialog" title="Yes Or No"><p>Do you wish to Yes or to No</p></div>');
$("#yesno_dialog").dialog({
title: "Yes or No",
resizable: false,
modal: true,
buttons: {
"Yes" : function () {
alert("You chose yes.. now let's do something else here");
$(this).dialog("close");
$(this).remove();
},
"No" : function (){
alert("You chose no.. now let's do something else here");
$(this).dialog("close");
$(this).remove();
}
}
});
}
But you probably just need to return the value from confirm
return confirm("Are you sure");