Conform Dialog Box in JavaScript

Confirm Dialog box serves as a technique for confirming user action. In JavaScript Confirm dialog box display these information:

1. A predefined message
2. Ok and Cancel button.

Confirm dialog box requires only ‘a pre-defined message to be displayed’ like this:

if user click on ‘Ok’ button then dialog box return True to the program, otherwise it returns False.


    <script language="javascript">
      var ans=confirm("Do you want to display date on Web page")
           document.write("You click on 'OK' <h1>Welcome to AuthorCode")
            document.write("you click on 'Cancel'")