JavaScript Tutorial




Lesson 10 - Prompts




You hve already learnt about alerts. But what if you wanted to collect info froma user, but with the style of an alert?

A prompt is just like an alert, but it has a text box with 2 buttons : Ok and Cancel. To get the user info from the prompt, the code is var example = prompt("Message");

Prompts are usually used to collect info like name, phone number, etc. They are very helpful in JS to reduce the HTML programming.




< Previous------------------------- Next >