HTML DOM confirm() Method
Complete Window Object Reference
Definition and Usage
The confirm() method is used to display a dialog box with a specified message and an OK
and a Cancel button.
Syntax
Example
<html>
<head>
<script type="text/javascript">
function disp_confirm()
{
var r=confirm("Press a button")
if (r==true)
{
document.write("You pressed OK!")
}
else
{
document.write("You pressed Cancel!")
}
}
</script>
</head>
<body>
<input type="button" onclick="disp_confirm()"
value="Display a confirm box" />
</body>
</html>
|
Try-It-Yourself Demos
Display a
confirm box
Complete Window Object Reference
|
|
|