javascript - Close Popup Window by Clicking on Parent onfocus -
i'm trying close popup created clicking on link within parent window, clicking on parent window. function controls seems work fine, not allow me click on links again open popup. suggestions? in advance!
the code listed below. fyi, code not formatted because involves numerous hacks legacy 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; } }
Comments
Post a Comment