- Alert Box
- Prompt Box
- Confirm Box
These Popup boxes are used to create alerts,take input from the user,get confirmation etc.
It is used to give warning or alert the user.If the user is submitting a form and required field is
left blank then you can alert the user by displaying a message on the screen.
The user will have to click “OK” to proceed.
Click on the button.
Alert box can also be displayed when a link is clicked by the user.
The Prompt box is also a Window Object like alert() and is used to take user input in a text field.
It is similar to the alert box except that it has two button “OK” and “Cancel” while Alert() has only one button “OK”.
- The label which you want the user to enter
- The value that you want to be displayed in a text box
Syntax Of Prompt Box:
Prompt Box(“Label”,”Default Value”)
This information can be stored in a variable and you can identify the visitor the next time he visits
Note:If the user returns “OK” then the text box returns the value else it returns “NULL”.
It is used to verify something from the user.It is similar to the alert box but it contains
two buttons “OK” and “Cancel”.If the user clicks “OK” then it returns true else it returns false.
Note:Alert(),Prompt,Confirm() are all methods of the Window Object.There are also other methods such
as createPopup(),focus(),Print(),scrollBy() etc.