Provides information to the user, and user has to click "OK" to proced.
alert("Hello world"); |
Confirm Box:
This pop-up requires a user response (either "OK" or "Cancel"). If the user clicks "OK", the function returns true. If the user clicks "Cancel", the function returns false. You can collect the response by assigning a variable to receive the function output.
var response = confirm("Are you sure you want to delete this?"); |
Prompt Box:
This pop-up requires the user to key in text input. When the user clicks "OK", the function returns the input value. You can also specify the default value of the input as the 2nd parameter of the function.
prompt("What is your name?","defaultname"); |
Try out the Javascript Popup Boxes here.
No comments:
Post a Comment