HTML and CSS Reference
In-Depth Information
Figure 4.3
Prompt without a second default argument.
Figure 4.4
Prompt with a second default argument.
The confirm dialog box is used to confirm a user's answer to a question. The user must
agree before the action is completed. You'll often see this when placing an online order
or deleting a file where a yes or no confirmation determines what will happen next. A
question mark will appear in the box with an OK button and a Cancel button. If the user
clicks the OK button,
true
is returned; if he or she clicks the Cancel button,
false
is
returned. This method takes only one argument, the question you will ask the user.
EXAMPLE
4.4
<html>
<head>
<title>Using the JavaScript confirm box</title>
</head>