<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-. 8" > < Script > function myFunction () { Alert ( " Hello, I am a warning box! " ); } </ Script > < / head > < body > < INPUT type = "Button" the onclick = "myFunction ()" value = "alert box displays" /> </ body > </html>
<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-. 8" > < title > novice tutorial (runoob.com) </ title > </ head > < body > < P > click on the button to display the confirmation frame. </ The p- > < the Button onclick = "myFunction ()" > point I </ the Button > < the p- the above mentioned id = "Demo" > < > Function myFunction () { var X; var R & lt = Confirm ( " press the button! " ); IF (R & lt == to true ) { X = " you press the \" OK \ "! " ; } The else { X = " you press the \" cancel \ "button! " ; } document.getElementById ( " Demo " ) .innerHTML = X; } </ Script > </ body > </html>
<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-8" > < title > newbie tutorial (runoob.com) </ title > </ head > < body > < the p- > Click the button to see input dialog box. </ The p- > < the Button onclick = "myFunction ()" > point I </ the Button > < the p- the above mentioned id = "Demo" > < > Function myFunction () { var the X-; var the Person = prompt ( " Please enter your name " , " Harry Potter " ); IF (the Person ! = Null && the Person ! = "" ) { The X- = " Hello " + the Person + " ! how are you feeling today? " ; document.getElementById ( " Demo " ) .innerHTML = the X-; } } </script> </body> </html>
<! DOCTYPE HTML > < HTML > < head > < Meta charset = "UTF-. 8" > < title > novice tutorial (runoob.com) </ title > </ head > < body > < P > click button pop The total newline. </ The p- > < the Button onclick = "myFunction ()" > point I </ the Button > < the p- the above mentioned id = "Demo" > < > function myFunction(){ alert("Hello\nHow are you?"); } </script> </body> </html>