2014-07-24 84 views
0

我有這樣的代碼使用Javascript - 彈出新的父窗口

function checkAlerts() { 
    secondsSinceLoad += 1; 
    for(var mj = 0 ; mj <= alertList.length; mj++) { 
        if(alertList[mj]['time'] < secondsSinceLoad && alertList[mj]['time'] > -1) { 
          alertmsg = alertList[mj]['type'] + ":" + alertList[mj]['name'] + "\n" +alertList[mj]['subtitle']+ "\n"+ alertList[mj]['description'] + "\n\n"; 
          window.open(alertList[mj]['redirect'],"name1","width=800,height=500,toolbar=no,location=no,menubar=no,copyhistory=no"); 
        } 
    } 
    alertsTimeoutId = setTimeout("checkAlerts()",1000); 

}

這是一個計劃的彈出窗口。它會正確創建一個彈出窗口,但是如果在同一時間有超過1個預定彈出窗口,則只會顯示1個彈出窗口。

P.S.我假設這是因爲「父彈出窗口打開相同的窗口」

幫助表示讚賞。

Thanx。

+0

無法同時處理多個彈出窗口.... –

回答

1

瀏覽器禁止在循環中打開多個彈出窗口,以阻止惡意站點用很多新窗口轟炸用戶。

避免彈出窗口並在一個窗口中顯示所有內容,解決此問題。