為什么一共彈出四個(gè)窗口????
第一次彈出確認(rèn)彈框,第二次彈出輸入彈框。。。第三次會(huì)在右邊顯示一個(gè)按鈕,點(diǎn)擊這個(gè)按鈕,就會(huì)出現(xiàn)一個(gè)顯示彈框,然后才是要打開(kāi)的新的網(wǎng)址。。。。為什么還要彈出一個(gè)顯示彈框呢????
<script type="text/javascript"> ?
? ? ?// 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
? ? var rec=confirm("請(qǐng)問(wèn)是否打開(kāi)新的窗口?");
? ? // 點(diǎn)擊確認(rèn)時(shí)彈出輸入框
? ? var sure=prompt("請(qǐng)輸入要打開(kāi)的新網(wǎng)址","http://idcbgp.cn");
? ? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? ? function openWindow(){
? ? ? ? if(rec==true){
? ? ? ? ? ? // 通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? ? ? alert(sure);
? ? ? ? }
? ? ? ? window.open(" http://idcbgp.cn/","_blank","width=1000px,height=600px");
? ? }
? </script>?
2017-07-11
2017-07-11
因?yàn)槟鉧lert了(sure),
?<script type="text/javascript"> ?
? ? function openWindow(){
? ? ? ? if(confirm("請(qǐng)問(wèn)是否打開(kāi)新的窗口?")){
? ? ? ? ? ? if(prompt("請(qǐng)輸入要打開(kāi)的新網(wǎng)址","http://idcbgp.cn")){
? ? ? ? ? ? ? ? window.open(" http://idcbgp.cn/","_blank","width=1000px,height=600px");
? ? ? ? ? ? }
? ? ? ? } ? ??
? ? }
? </script>?