<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
#confirmBox {
width:10em;
height:5em;
position:absolute;
z-index:1;
visibility:hidden;
background:blue;
color:white;
border:6px double white;
text-align:center;
}
</style>
<script type="text/javascript">
var answerFunction;
function myConfirm(text,button1,button2,answerFunc)
{
var box = document.getElementById("confirmBox");
box.getElementsByTagName("p")[0].firstChild.nodeValue = text;
var button = box.getElementsByTagName("input");
button[0].value=button1;
button[1].value=button2;
answerFunction = answerFunc;
box.style.visibility="visible";
}
function answer(response)
{
document.getElementById("confirmBox").style.visibility="hidden";
answerFunction(response);
}
function tester(button)
{
myConfirm("Say Aye or Nay!","Aye","Nay",
function(answer)
{
button.value="Last answer was: "+(answer?"Aye":"Nay");
});
}
</script>
</head>
<body>
<div id="confirmBox">
<p>Continue?</p>
<p><input type="button" onclick="answer(true)" value="Ok">
<input type="button" onclick="answer(false)" value="Cancel"></p>
</div>
<input type="button" value="Answer me!" onclick="tester(this)">
</body>