May 06, 2021 JavaScript
You can create three message boxes in JavaScript: the warning box, the confirmation box, and the prompt box.
Warning boxes are often used to ensure that users have access to certain information.
When the warning box appears, the user needs to click the OK button to proceed.
The window.alert() method can use the alert() method directly without the window object.
Confirmation boxes are typically used to verify that user actions are accepted.
When the confirmation card pops up, the user can click "Confirm" or "Cancel" to determine the user action.
When you click "Confirm", the confirmation box returns true, and if you click "Cancel", the confirmation box returns false.
The window.confirm() method can take the window object without it and use the confirm() method directly.
Prompt boxes are often used to prompt the user to enter a value before entering the page.
When the prompt box appears, the user needs to enter a value and click the confirm or cancel button to continue manipulating.
If the user clicks Confirm, the return value is the value entered. If the user clicks Cancel, the return value is null.
The window.prompt() method can take the window object without it and use the prompt() method directly.
Tip: You can learn more about the Window prompt() method in this site!
The spring window uses a backslash plus "n" to set the line change.