本文實(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 + " 今天過(guò)得怎么樣?")  }}</script></head><body><input type="button" onclick="disp_prompt()" value="顯示提示框" /></body></html>希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注