If I were you, I would look at one of the popular javascript libraries. Most of them contain some kind of modal dialogue.
The pair I found for jQuery, jqModal and SimpleModal .
When you create a modal dialog, you need to bind events to buttons so that you do something like:
function askUserYesOrNo() {
var myDialog = $('<div class="mydialog"><p>Yes or No?</p><input type="button" id="yes" value="Yes"/><input type="button" id="no" value="No"/></div>');
$("#yes").click(handleYes);
$("#no").click(handleNo);
myDialog.modal();
}
function handleYes() {
}
function handleNo() {
}