SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jan 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie Popup window- Parent window issue

    So you'll have to bear with me since the site I'm working on I've inherited and I've only just started to mess around with javascript so my understanding of it ranges from rudimentary to nonexistent.

    We have a link on our site that pulls up a page from our in-house server so people can check availability before making a reservation. It uses javascript for the popup but the problem is when you click on the parent window and navigate away it closes the popup. It would be nice if people could keep the availability page open while looking through the site at the different cabins. I've included a link the page in question and the javascript below. Thanks in advance for any help and patience.

    Code JavaScript:
    function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
      var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
      if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
      if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
      if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
        if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
    		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
    		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
    		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
        features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
      if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
      if (window["popupWindow"] == null) window["popupWindow"] = new Array();
      var wp = popupWindow.length;
      popupWindow[wp] = window.open(theURL,winName,features);
      if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
      if (document.all || document.layers || document.getElementById) {
        if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
        if (alwaysOnTop && alwaysOnTop != "") {
        	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
        	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
        if (autoCloseTime && autoCloseTime > 0) {
        	popupWindow[wp].document.body.onbeforeunload = function() {
      			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
        		window.onbeforeunload = null;	}  
       		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
      	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }   
      document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
    }

    and the link
    Code HTML4Strict:
    <a style="text-decoration:underline;" target="blank" href="javascript:; " onClick="GP_AdvOpenWindow('getPage.php?page=oHutAvail.asp&hsID=1,3','tenth','fullscreen=no,toolbar=yes,location=no,status=no,menubar=yes,scrollbars=yes,resizable=yes',620,525,'topcenter','ignoreLink','',30,'');return document.MM_returnValue">
    Last edited by Mittineague; Oct 1, 2013 at 21:03. Reason: removed faux signature


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •