confirm method (window)
Displays a confirmation dialog with a message that the user needs to respond to.
The confirmation dialog contains an OK and a Cancel button.
Script execution does not continue until the confirm method returns (the user presses the OK or Cancel button or closes the confirmation dialog).
Syntax:
You can find the related objects in the Supported by objects section below.
Parameters:
Optional. String that specifies the text for the message in the dialog box. Default is an empty string. This parameter is required in Firefox. |
Return value:
Boolean. One of the following values:
The confirmation dialog was closed by the Cancel button or by the system Close button. | |
The confirmation dialog was closed by the OK button. |
Example HTML code 1:
This example illustrates the use of the confirm method:
|
||||
<head> <script type="text/javascript"> function CanContinue () { var confRet = window.confirm ("Do you want to continue the operation?"); if (confRet) { alert ("The operation is continued."); } else { alert ("The operation is stopped."); } } </script> </head> <body> <button onclick="CanContinue ()">Create a confirmation dialog</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments