in JavaScript by
Q:
What are the pop-up boxes available in JavaScript?

1 Answer

0 votes
by

Below are some examples of popup boxes in javascript

  • Alert Box
  • Confirm Box
  • Prompt Box

Example of alert() in JavaScript

  1. <script type="text/javascript">  
  2. function msg(){  
  3.  alert("Hello Alert Box");  
  4. }  
  5. </script>  
  6. <input type="button" value="click" onclick="msg()"/>  

Example of confirm() in JavaScript

  1. <script type="text/javascript">  
  2. function msg(){  
  3. var vconfirm("Are u sure?");  
  4. if(v==true){  
  5. alert("ok");  
  6. }  
  7. else{  
  8. alert("cancel");  
  9. }  
  10.   
  11. }  
  12. </script>  
  13.   
  14. <input type="button" value="delete record" onclick="msg()"/>  

Example of prompt() in JavaScript

  1. <script type="text/javascript">  
  2. function msg(){  
  3. var vprompt("Who are you?");  
  4. alert("I am "+v);  
  5.   
  6. }  
  7. </script>  
  8.   
  9. <input type="button" value="click" onclick="msg()"/>  

Related questions and answers

0 votes
asked May 17, 2019 in Python by Derya
+1 vote
asked Jan 8 in Kafka Premiera Ola by GeorgeBell
0 votes
asked Jun 8 in JavaScript by sharadyadav1986
...