We have used the alert() method, prompt() method, and prompt() method in some examples. They all pop up a dialog box on the screen and display the content in brackets on it. Use this This method makes the interactivity of the page more exciting. In fact, we often use this type of dialog box when browsing web pages. Dialog boxes are often used when users have two-way communication with applications.
The three dialog boxes of JavaScript are obtained by calling the three methods alert(), confirm() and prompt() of the window object. You can use these Dialog box to complete js input and output, and implement js code that can interact with users.
Today the editor will briefly introduce the three pop-up dialog boxes in js. The editor will first explain these methods in detail separately, and then compare these methods. Okay, let’s start. Our js journey `(*∩_∩*)′......First: alert() method
<html> <head> <title>编写html页面</title> <script language="javascript"> //JavaScript脚本标注 alert("上联:山石岩下古木枯");//在页面上弹出上联 alert("下联:白水泉边少女妙");//在页面上弹出下联 </script> </head>
Execute the above small example, a dialog box will pop up on the page and display the sentence "First line: The ancient trees are dead under the rocks." , as shown below:
a、在