Javascript Reference
Categories: window

javascript window confirm( )

@April 12, 2008, 10:23 a.m.
confirm( ) Firefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM n/a  



Displays a dialog box with a message and two clickable buttons. Script execution halts while the dialog box appears. 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( );
  • Any string, usually in the form of a question.
Returned Value

Boolean value: true | false.

Powered by Linode.