亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

本文實(shí)例講述了JS彈出對(duì)話框?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("請(qǐng)輸入您的名字","Bill Gates")
if (name!=null && name!="")
  {
  document.write("你好!" + name + " 今天過得怎么樣?")
  }
}
</script>
</head>
<body>
<input type="button" onclick="disp_prompt()" value="顯示提示框" />
</body>
</html>

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

相關(guān)文章

最新評(píng)論