關(guān)于第二個對話框窗口關(guān)閉的問題
{
? var k_open;
? var temp=confirm("是否要打開新的網(wǎng)頁?");
? if(temp)?
? ? { ??
? ? ? ? k_open=prompt("請輸入你要打開的網(wǎng)址:","http://idcbgp.cn/");
? ? ? ?window.open(k_open,'_blank','width=400,height=500,menubar=no,toolbar=no');
? ?}
? ??
}
這是評論區(qū)某位朋友的代碼,的確可以按照條件運(yùn)行,我想添加一個在點(diǎn)去第一個confirm的確定按鈕后,再點(diǎn)porompt對話框取消的時候不會再有新窗口彈出的功能。我在后面添加了else{Window.close();},可是發(fā)現(xiàn)這只是對于confirm的取消進(jìn)行回應(yīng)。求問如何修改?
2016-12-29
function openWindow(){
? ? ? ? var which=confirm("是否打開");
? ? ? ? if (which){
? ? ? ? ? ? var one=prompt("請輸入你要打開的網(wǎng)址:","http://idcbgp.cn/");
? ? ? ? ? ? if (one=="http://idcbgp.cn/"){
? ? ? ? ? ? ? ? window.open('http://idcbgp.cn/','_blank','width=400,heigth=500')
? ? ? ? ? ? }
? ? ? ? ? ? else{? ? ? ??
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else{?
? ? ? ? }
? ? ? ? }