定义三个输入控件,点击进入对应的函数

<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>

 

相关文章:

  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-01-03
猜你喜欢
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-01-04
  • 2021-11-06
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案