哪位大神看一下,我這個按取消會有英文字母出現(xiàn),怎么解決,謝謝
?function openWindow(){
? ? var open=confirm("是否打開") // 新窗口打開時彈出確認框,是否打開
? ? if(open==true)
? ? {document.write(duihua);}
? ? else
? ? {document.write(win.close());}
? ? var duihua=prompt("確定打開的網址","http://idcbgp.cn/") // 通過輸入對話框,確定打開的網址,默認為 http://idcbgp.cn/
? ? if(duihua==null)
? ? {document.write(win.close());}
? ? else
? ? {document.write(win);}
? ? var win=window.open('http://idcbgp.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ? }?
2019-07-21
function openWindow(){
? ? var open=confirm("是否打開") // 新窗口打開時彈出確認框,是否打開
? ? if(open==true)
? ? {document.write(duihua);}
? ? else
? ? { window.close();}
? ? var duihua=prompt("確定打開的網址","http://idcbgp.cn/") // 通過輸入對話框,確定打開的網址,默認為 http://idcbgp.cn/
? ? if(duihua=="")
? ? {window.close();}
? ? else
? ? {document.write(win);}
? ? var win=window.open('http://idcbgp.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ? 你的win是你自己定義的window.open,所以win.close就等于window.open.close,window并沒有這個方法,所以報錯,你用上面的代碼試試