Confirm box is a dialog box which displays a message in a small window with two buttons. One Ok and other Cancel. This method can be used to get the response of user in positive by clicking on ok and in negative by clicking on cancel. The value returned by the confirm method in case of OK is true and in case of Cancel is false. A programmer can program the code for positive and negative situations depending on the response returned by the user. |
Example |
<html>
<head> </head> <body> <script type=”text/JavaScript”> a=confirm(” Want to Proceed ? “); document.write(“Your have clicked on : “+a); </script > </body> </html> |
Understanding the program: |
If user will clicks on Ok then you have clicked on true will appear If user will clicks on Cancel then you have clicked on false will appear |