定义三个输入控件,点击进入对应的函数
<html> <head> <script> function show_alert() { alert("I am alert"); } function show_confirm() { var r = confirm("Press a button!") if (r == true) { alert("You pressed OK!"); } else { alert("Your pressed Cancel!"); } } function show_prompt() { var name = prompt("Please input your name", "Bill Gates") if (name != null && name != "") { document.write("Hello!" + name + " How are you?") } } </script> </head> <body> <input type="button" onclick="show_alert()" value="show a alert"/> <input type="button" onclick="show_confirm()" value="show a confirm"/> <input type="button" onclick="show_prompt()" value="show a prompt"/> </body> </html>
本文转自jihite博客园博客,原文链接:http://www.cnblogs.com/kaituorensheng/p/4605385.html,如需转载请自行联系原作者