InterviewSolution
| 1. |
What are the different types of popup boxes in JavaScript? |
|
Answer» JavaScript provides three TYPES of pop-up boxes to display notifications and messages to users. They are: 1. Alert BOX - This pop-up box is used to give information to the user. This box CONTAINS a message and an OK button, that the users can click to CLOSE the popup box. 2. Confirm Box - This type of pop-up box is used to obtain confirmation from the user. This box contains a message and two buttons - OK and CANCEL, out of which the user has to select one. The user can click the OK button to confirm the decision and click the Cancel button to disagree with the decision. Clicking either of the buttons will close the popup. Based on which button is clicked by the user, the function to open the confirm box will return a boolean indicating whether the user has confirmed or not. 3. Prompt Box - The prompt box is used to display a text box in order to take user input, followed by OK and Cancel confirmation buttons. If the user enters a value and clicks OK, the function to create the prompt box will return the value that was entered. If the user clicks Cancel, null is returned. |
|