The three "commands" involved in creating alert, confirm, and prompt boxes are:
- window.alert()
- window.confirm()
- window.prompt()
<body> <script type="text/javascript"> window.alert("Iam an alert box!!!") </script> </body>window.confirm(): Confirm is used to confirm a user about certain action, and decide between two choices depending on what the user chooses.
<body> <script type="text/javascript"> var x=window.confirm("Are you sure?") if (x) window.alert("Yes!") else window.alert("No") </script> </body>window.prompt(): Prompt is used to allow a user to enter something, and do something with that info:
<body> <script type="text/javascript"> var y=window.prompt("Enter your name here...") window.alert(y) </script> </body>
Comments
Post a Comment