為什么運(yùn)行不了?
function openWindow(){
? ? var op=confirm("是否打開?");// 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? if(op==true)
? ? ? ? ?{? var a=prompt("打開的網(wǎng)址為:","http://idcbgp.cn/");
? ? ? ? ? ? ? //通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? ? ? ?if(a!=null)
? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ?window.open("a","_blank","width=400,height=500,menubar=no,toolbar=no");//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? ? ? ? ?}
? ? ? ? else{
? ? ? ? ? ? alert("請(qǐng)輸入網(wǎng)址");
? ? ? ? }
? ? }
? ? else{
? ? ? ? alert("很高興遇見你!");
? ? }
}
2018-09-19
window.open后面的a不要加引號(hào),單引號(hào)雙引號(hào)什么的都可以用的,請(qǐng)采納,謝謝!?。?/p>
2018-09-24
引號(hào)問題解決了,你的代碼能運(yùn)行嗎?我的運(yùn)行不了
2018-09-20
window.open()里面的a是前面var創(chuàng)建的一個(gè)變量名,在open里引用時(shí)無需再加引號(hào)了
2018-09-19
window.open()這個(gè)里面用的是單引號(hào),而非雙引號(hào)