Name
confirm( ) — NN 2 IE 3 DOM n/a
Synopsis
confirm(message
)
Displays a dialog box with a message and two clickable buttons. One
button indicates a Cancel operation;
the other button indicates the user’s approval (OK or Yes).
The text of the buttons is not scriptable. The message should ask a
question to which either button would be a logical reply. A click of
the Cancel button returns a value of
false
; a click of the OK button returns a value of true
.
Because this method returns a Boolean value, you can use this method inside a condition expression:
if (confirm("Reset the entire form?")) { document.forms[0].reset( ) }
Returned Value
Boolean value: true
| false
.
Parameters
-
message
Any string, usually in the form of a question.
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.