<strong>1.警告提示框 <br></strong>alert("文本")。 <br>ex. <br><div class="htmlarea"> <textarea id="runcode22857"> <script type="text/javascript"> function disp_alert() { alert("我是警告框!!"+'\n'+"hhah")//有折行 } </script> <input type="button" onclick="disp_alert()" value="显示警告框"> </textarea><br><input onclick="runEx('runcode22857')" type="button" value="运行代码"> <input onclick="doCopy('runcode22857')" type="button" value="复制代码"> <input onclick="doSave(runcode22857)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br><strong>2.确认提示框(confirm,返回true或者false)</strong> <br><div class="htmlarea"> <textarea id="runcode14571"> <script type="text/javascript"> function show_confirm() { var r=confirm("Press a button!"); if (r==true) { alert("You pressed OK!"); } else { alert("You pressed Cancel!"); } } </script> <input type="button" onclick="show_confirm()" value="Show a confirm box"> </textarea><br><input onclick="runEx('runcode14571')" type="button" value="运行代码"> <input onclick="doCopy('runcode14571')" type="button" value="复制代码"> <input onclick="doSave(runcode14571)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br><strong>3.提示框(prompt返回文本框的文本)</strong> <br><div class="htmlarea"> <textarea id="runcode92545"> <script type="text/javascript"> function disp_prompt() { var name=prompt("请输入您的名字","Bill Gates") if (name!=null && name!="") { document.write("你好!" + name + " 今天过得怎么样?") } } </script> <input type="button" onclick="disp_prompt()" value="显示提示框"> </textarea><br><input onclick="runEx('runcode92545')" type="button" value="运行代码"> <input onclick="doCopy('runcode92545')" type="button" value="复制代码"> <input onclick="doSave(runcode92545)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>