CodesJava

Easy learning with example program codes

Javascript confirmation dialog box


 
Javascript confirmation dialog box is used to display a message to the user for confirming something.
Note: Confirmation dialog box gives two button “OK” and “Cancel”. The confirm() method returns true if Ok button is clicked else returns false.

Example:

<!DOCTYPE html>
<html>
<body> 
<script>    
function getConfirmation(){
  var retVal = confirm("Do you want to continue?");
  if( retVal == true ){
       document.write ("User wants to continue!");
        return true;
   }
   else{
        document.write ("User does not want to continue!");
        return false;
    }
}
</script>   
<p>Click Submit button and see result.</p>      
<form>
 <input type="button" onclick="getConfirmation()" value="Submit" />
</form>
</body>
</html>

Try it:

JS Bin on jsbin.com
 



Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki