<strong>1.警告提示框 <br></strong>alert("文字")。 <br>ex. <br><div class="htmlarea"> <textarea id="runcode22857"> <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="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 全選注:</a>如需引入外部Js需刷新才能執行</div>]<br> <strong></strong>2.確認提示框(confirm,回傳true或false)<br> <div class="htmlarea"> <textarea id="runcode14571"> <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="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank"> </a>[Ctrl A 全選注:</div>如需引入外部Js需刷新才能執行<br>]<strong> </strong><br>3.提示框(prompt返回文字框的文字)<div class="htmlarea"> <textarea id="runcode92545"> <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="保存代码"><a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank"> </a> </div>[Ctrl A 全選 註:<script type="text/javascript"> function disp_alert() { alert("我是警告框!!"+'\n'+"hhah")//有折行 } </script>如需引入外部Js需刷新才能執行<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>]<script type="text/javascript"> function disp_prompt() { var name=prompt("请输入您的名字","Bill Gates") if (name!=null && name!="") { document.write("你好!" + name + " 今天过得怎么样?") } } </script>