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