Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Javascript:Confirmation Dialog Box

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 221
    Comment on it

    Confirmation dialog Box is used to get confirmation on any input. It is mostly used to take user's opinion on any option. It displays a dialog box with two buttons: Cancel and OK.

    If the user clicks on the Cancel button, then confirm() returns false.

    Similarly when the user clicks on the OK button, the window method confirm() will return true.

    Have a look on this simple example to understand the concept of confirmation dialog box: -

    <body>
          <p>Click on the button below to confirm </p>
    
          <form>
             <input type="button" value="Click Me" onclick="getConfirmation();" />
          </form>
          <script type="text/javascript">
                function getConfirmation(){
                   var retVal = confirm("Do you want to continue ?");
                   if( retVal == true ){
                      document.write ("Reeady to continue");
                      return true;
                   }
                   else{
                      document.write ("Not ready to continue");
                      return false;
                   }
                }
          </script>
       </body>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: