the alert prompt confirm dialog box is usually used.
<HTML> <br/> <pead> <br/> <title> simple example dialog box </title> <br/> </pead> <br/> <body> <br/> <MCE: script Type = "text/JavaScript"> <! -- </P> <p> alert ("good morning! "); <Br/> // alert only accepts one parameter, which is a string, all alert does is return this string to the user in a prompt box, we have seen this usage many times before <br/> alert ("hello," + prompt ("What's your name? ") + "! "); <Br/> // prompt is a query box that generates a query input window, wait for the user input result <br/> // to continue executing the following <SPAN class = 'wp _ keywordlink '> Program </span>. When the user input is complete, after you click OK, it returns the input string <br/> // if the user clicks the cancel button, then it will return NULL <br/> If (confirm ("are you OK? ") <Br/> // confirm is a confirmation box that generates a Yes | no confirmation box. If yes is answered, it returns true <br/> // if no is answered, it returns false <br/> alert ("greate! "); <Br/> else <br/> alert (" Oh, what's wrong? "); <Br/> // --> </MCE: SCRIPT> <br/> </body> <br/>
You can also define a new window simulation dialog box
<HTML> <br/> <pead> <br/> <title> example simulation dialog box </title> <br/> </pead> <br/> <body> <br/> <button onclick = "opennew () "> open </button> <br/> <MCE: Script Type =" text/JavaScript "> <! -- <Br/> function opennew () {<br/> // doucment. createelement can be used to construct a new DOM object <br/> var W = document. createelement ("Div "); </P> <p> // the following set of style attributes control the style of the simulated window <br/> // The style attribute provided by Dom makes it easy for JavaScript to Control Element display Mode </P> <p> W. style. top = 50; <br/> W. style. left = 50; <br/> W. style. height = 100; <br/> W. style. width = 300; <br/> W. style. position = "absolute"; <br/> W. style. background = "#00 FFFF"; <br/> W. style. paddingtop = 10; </P> <p> // Add the created Div Element Object to the body content using the appendchild () method. <br/> W. innerhtml + = ("<center> I & nbsp; D & nbsp;: <input> <br> password: <input> <br> </center> "); <br/> document. body. appendchild (w); <br/>}< br/> // --> </MCE: SCRIPT> <br/> </body> <br/> </ptml>