Home > Article > Web Front-end > What is a JavaScript alert box?
JavaScript warning box can be implemented through the alert() method. Its usage syntax is "alert("the text content you want to prompt")"; and the function of the warning box is to ensure that the user can get certain information.
The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
What is the JavaScript alert 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.
alert ()
alert() method displays an alert box with a pop-up prompt message and a confirmation button.
It should be noted that: alert() is a blocking function. If we do not click the confirmation button, the subsequent content will not be loaded.
Usage:
alert("想要提示的文本内容")
Sample code:
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <script> alert("这是弹出框提示文本") </script> <title></title> </head> <body> <p>alert是阻塞的函数</p> <p>这句话只有在确认弹出框的提示文本后才会显示</p> </body></html>
Effect screenshot:
Recommended study: "javascript basic tutorial"
The above is the detailed content of What is a JavaScript alert box?. For more information, please follow other related articles on the PHP Chinese website!