First, JS of the three most common dialog box
====================== js most commonly used three pop-up dialog boxes ======================== //Popup dialog box and output a message function ale () { //Popup a dialog box alert ("Hint info! "); } //pops up a query box, There are ok and Cancel Buttons function firm () { //value returned using the dialog box (true or false) if (Confirm ("Are you sure to submit it?") ")) { alert (" clicked OK "); } else { &nbsP; alert ("clicked Cancel"); } } //pops up an input box, Enter a text to submit function prom () { var name = prompt ("Please enter your name", "); //assigns the input to the variable name , //here to note is that prompt has two parameters, preceded by a hint, The following is when the dialog box comes out, the default value in the dialog box if (name)//If the returned has content { alert ("Welcome:" + name) } }
Ii. 6 prompt boxes and actions commonly used when clicking a button
<!-----------button prompt----------> <input type= "button" name= "btn2" id= "BTN2" value= "Delete" onclick= "return confirm (' yes/no ');); <!----------- button Prompt box----------> <input type= "button" name= "btn2" id= "btn2" value= " Hint " onclick=" Javascript:alert (' Are you sure you want to delete it? '); <!-----------submit button----------> <input type= "button" value= "Submit" onclick= "javascript:window.location.href= ' http://www.baidu.com ';" /> <!-----------Close button----------> <input type= "button" value= "Close" onclick= "javaScript:window.close ();" > <!-----------return and close the connection----------> <a href= "#" Onclick= "Javascript:;window.opener.location.reload (); Window.close ()" > Return </a> javascript: Window.location.reload ();//returns the current page and refreshes the <! -----------return to the previous page----------> <input type= "button" name= "button" value= " < return to " onclick=" Javascript:history.go ( -1) "/>
This article from "Kangjunfei" blog, declined reprint!
JS popup box, dialog box, cue box, pop-up window summary