1. Warning Prompt box
Alert ("Text").
Ex.
<ptml> <pead> <script type= "Text/javascript" > Function Disp_alert () {alert ("I am a warning box!!") "+ ' \ n ' +" Hhah ")//There is a folded line} </script> </pead> <body> <input type=" button "onclick=" Disp_alert () "Value = "Show Warning box"/> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
2. Confirm Prompt box (confirm, return True or False)
<ptml> <pead> <script type= "Text/javascript" > Function show_confirm () {var r=confirm ("Press a butt On! "); if (r==true) {alert ("You pressed ok!"); else {alert ("You pressed cancel!"); } </script> </pead> <body> <input type= "button" onclick= "Show_confirm ()" Value= "show a confirm Box "/> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
3. Prompt box (prompt returns the text of the text box)
<ptml> <pead> <script type= "Text/javascript" > function Disp_prompt () {var name=prompt ("Please enter your name", "Bill Gates") if (name!=null && name!= "") {document.write ("Hello!") "+ name +" How was your day? ")} </script> </pead> <body> <input type=" button "onclick=" Disp_prompt () "value=" Show Prompt Box "/> ; </body> </ptml>
[ctrl+a All selected note: If you need to introduce external JS need to refresh to perform]