标签:
定义三个输入控件,点击进入对应的函数
<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>
标签:
原文地址:http://www.cnblogs.com/kaituorensheng/p/4605385.html