Alert prompt confirm part 2

Prompt Box



prompt box is often used to have the user input a value before entering a page.
When a prompt box pops up, the user will have to click either OK or Cancel to proceed after entering the input value.
If the user clicks OK, the box returns the input value. If the user clicks Cancel, the box returns null.

The prompt() method takes two parameters
- The first is the label, which you want to display in the text box.
- The second is a default string to display in the text box (optional).

Example:
var user = prompt("Please enter your name");
alert(user);
Try It Yourself

The prompt appears as:
When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. Do not overuse this method, because it prevents the user from accessing other parts of the page until the box is closed

Comments

Popular posts from this blog

String Operators

Introducing object part 3

The math object part 2