Home >Web Front-end >JS Tutorial >How to use javascript dialog box (alert box, javascript confirmation box, prompt box)_Basic knowledge
1. Warning box
Alert boxes are often used to ensure that users can get certain information.
When the warning box appears, the user needs to click the OK button to continue the operation.
Syntax:
2. Confirmation box
Confirmation boxes are used to allow users to verify or accept certain information.
When the confirmation box appears, the user needs to click the OK or Cancel button to continue the operation.
If the user clicks Confirm, the return value is true. If the user clicks Cancel, the return value is false.
Syntax:
3. Prompt box
Prompt boxes are often used to prompt users to enter a certain value before entering the page.
When the prompt box appears, the user needs to enter a certain value and then click the confirm or cancel button to continue the operation.
If the user clicks Confirm, the return value is the entered value. If the user clicks Cancel, the return value is null.
Syntax:
Example: