欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS彈出對話框?qū)崿F(xiàn)方法(三種方式)

 更新時(shí)間:2015年12月18日 10:46:32   作者:HackerVirus  
這篇文章主要介紹了JS彈出對話框?qū)崿F(xiàn)方法,結(jié)合實(shí)例形式分析了三種方式,包括alert、confirm及prompt,非常簡單實(shí)用,需要的朋友可以參考下

本文實(shí)例講述了JS彈出對話框?qū)崿F(xiàn)方法。分享給大家供大家參考,具體如下:

1.警告框

<html>
<head>
<script type="text/javascript">
function disp_alert()
{
alert("我是警告框?。?)
}
</script>
</head>
<body>
<input type="button" onclick="disp_alert()" value="顯示警告框" />
</body>
</html>

2.確定取消框

<html>
<head>
<script type="text/javascript">
function disp_confirm()
{
var r=confirm("按下按鈕")
if (r==true)
  {
  document.write("您按了確認(rèn)!")
  }
else
  {
  document.write("您按了取消!")
  }
}
</script>
</head>
<body>
<input type="button" onclick="disp_confirm()" value="顯示確認(rèn)框" />
</body>
</html>

3.有輸入的框

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

希望本文所述對大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論