A quick and dirty guide to the three types of modal (i.e. blocking) native dialog boxes available via javascript. I do not believe these are part of any spec, but every browser supports these.
NOTE: I originally wrote this in June 2005 since the available documentation on the interweb was horrible, IE only, and/or frequently wrong. Sadly still true, however this document is still accurate. I hope it helps. Enjoy. –nickg July, 2007
function testAlert() {
alert("This is an alert");
}
function testConfirm() {
e = document.getElementById("confirmResult");
result = confirm("Continue?");
if (result) {
e.innerHTML = "OK"
} else {
e.innerHTML = "Cancelled"
}
}
function testPrompt() {
e = document.getElementById("promptResult");
result = prompt("Type something:");
if (result == null) {
e.innerHTML = "Canceled";
} else {
e.innerHTML = "You typed: " + result;
}
}