1 Reply Latest reply on May 19, 2008 8:29 PM by sadfba

    Javascript Pop-up window

    sadfba
      I am using Javascript to open pop-up windows to display websites I have designed. The problem I am having is when I open a site that is html based and navigate through the site my launch button doesn't work when the user returns to my design site. I am not having the problem if the site being opened is flash based.

      These are the functions I am using the vars are being passed by an xml file. The first to close any open windows. The second to open a new window.

      function closeWindow() {
      getURL("javascript:myWin1.close(); void(0);");
      }

      function openWindow(ur:String, wh:Number, he:Number, sc:Number, re:Number):Void {
      openWin1 = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
      getURL("javascript:var myWin1;if (!myWin1 || myWin1.closed){myWin1=window.open('"+url+"', '"+winName+"', '"+"width="+w+", height="+h+", toolbar="+toolbar+", location="+location+", directories="+directories+", status="+status+", menubar="+menubar+", scrollbars="+scrollbars+", resizable="+resizable+", top='+((screen.height/2)-("+h/2+"))+', left='+((screen.width/2)-("+w/2+"))+'"+"')} else{myWin1.focus();};void(0);");
      };

      address = ur;
      winName = "design";
      width = wh;
      height = he;
      toolbar = 0;
      location = 0;
      directories = 0;
      status = 0;
      menubar = 0;
      scrollbars = sc;
      resizable = re;
      openWin1(address,winName,width,height,toolbar,location,directories,status,menubar,scrollb ars,resizable);
      }

      If I wait for five seconds or so my launch button starts working again.

      If anyone has a clue as to why this is happening, a response would be greatly appreciated.
        • 1. Re: Javascript Pop-up window
          sadfba Level 1
          Solved

          Added myWin1.blur to if statement and everthing is working.

          function openWindow(ur:String, wh:Number, he:Number, sc:Number, re:Number):Void {
          openWin1 = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
          getURL("javascript:var myWin1;if (!myWin1 || myWin1.closed || myWin1.blur){myWin1=window.open('"+url+"', '"+winName+"', '"+"width="+w+", height="+h+", toolbar="+toolbar+", location="+location+", directories="+directories+", status="+status+", menubar="+menubar+", scrollbars="+scrollbars+", resizable="+resizable+", top='+((screen.height/2)-("+h/2+"))+', left='+((screen.width/2)-("+w/2+"))+'"+"')} else{myWin1.focus();};void(0);");
          };

          address = ur;
          winName = "design";
          width = wh;
          height = he;
          toolbar = 0;
          location = 0;
          directories = 0;
          status = 0;
          menubar = 0;
          scrollbars = sc;
          resizable = re;
          openWin1(address,winName,width,height,toolbar,location,directories,status,menubar,scrollb ars,resizable);
          }