Mega Code Archive

 
Categories / JavaScript Tutorial / Dialogs
 

Use confirm method in if statement

< html> <head> <script language="JavaScript" type = "text/javascript"> <!-- var username = prompt("Type your name:", ""); if (confirm("Your name is: " + username + ". Is that correct?") == true ) {   alert("Hello " + username); } else {   alert("Hi"); } //--> </script> </head> </html>