1

我试图关闭通过单击父窗口中的链接创建的弹出窗口,方法是单击父窗口。控制它的功能似乎工作正常,但不允许我再次单击链接以打开另一个弹出窗口。有什么建议么?提前致谢!

代码如下所示。仅供参考,代码的格式不是很好,因为它涉及旧版 CMS 的大量黑客攻击:

 var chkListWindow;

function ChkListPopup(guidNum){
  if(typeof chkListWindow === "null" || typeof chkListWindow === "undefined"){
              //do nothing
       }else{
              chkListWindow.close();
       }
  chkListWindow = window.open('','_blank', 'width = 1050, height = 680, scrollbars=no, titlebar=no, status=no, toolbar=no, location=no, top=0;');
  chkListWindow.document.write(
"<div class='scrollBox' style='width:100%; height:680px; margin:-15px 0 0 -10px; padding:0; border:0; text-align:center;'>"
    +"<div class'scrollContent' style='position:absolute; margin:80px 0 0 75px; width:900px; height:517px; overflow:auto; border:solid 1px #bababa; background-color:#fff'>"
        +"<img src='MediaServer?id="+guidNum+"'>"
    +"</div>"
    +"<div class='bgImg' style='width:1050px; height:680px; position:fixed !important; margin:0; padding:0; border:0; z-index:5;'>"
        +"<img src='MediaServer?id=DCA3205241531B8226B21308001A01E2'>"
    +"</div>"
+"</div>");
}

window.onfocus = function(){
    if(typeof chkListWindow === "null" || typeof chkListWindow === "undefined"){
        //do nothing
    } else {
        chkListWindow.close();
        chkListWindow = null;
    }
}
4

0 回答 0