The alert and confirm in JavaScript are function call to display messages to the user. In this Javascript tutorial, we will see an example which uses both alert and confirm function calls.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>Learn Java Script</TITLE> </HEAD> <BODY> <H1> Java Script Alert </H1> <br/> <script type="text/javascript" > //Sample 01: Display Confirm var ret = confirm("Do you want to submit?"); //Sample 02: Display Alert Message if (ret == true) alert("Document Submitted to Server"); else alert("Document Cancelled"); </script> </BODY> </HTML> |
Categories: C++, JavaScript-Tube