现在的位置: 首页 > 综合 > 正文

prompt()方法

2013年10月11日 ⁄ 综合 ⁄ 共 283字 ⁄ 字号 评论关闭

<html>
<head>
<script type="text/javascript">
function disp_prompt()
  {
  var name=prompt("请输入您的名字","Bill Gates")
  if (name!=null && name!="")
    {
    document.write("你好!" + name + " 今天过得怎么样?")
    }
  }
</script>
</head>
<body>

<input type="button" onclick="disp_prompt()" value="显示提示框" />

</body>
</html>

点击显示提示框

弹出如下图

抱歉!评论已关闭.