title: show one popup window at a time
body: <p>how to show only one popup at a time?</p>
  
  <p>i have created one page called parent.html. On parent page, i have two links one is <strong>register</strong> and another is <strong>login</strong>.
  if i click register then register page open as child window
  but
  if i click login then already opened child box(register) should close and login child window should open or all previously opened child box should disappear.</p>
  
  <p>my code is as below</p>
  
  <pre><code>&lt;input type="button" value="login" onclick="ShowPopup('login.asp')" /&gt;
  &lt;script type="text/javascript"&gt;
   var popup;
      function ShowPopup(url) {
          popup = window.open(url, "self", "toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=0,width=100,height=100,left = 490,top = 262");
          popup.focus();
      }
  &lt;/script&gt;
  &lt;/form&gt;
  
  &lt;input type="button" value="register" onclick="ShowPopup('register.asp')" /&gt;
  &lt;script type="text/javascript"&gt;
      var popup;
      function ShowPopup(url) {
          popup = window.open(url, "self", "toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=0,width=100,height=100,left = 490,top = 262");
          popup.focus();
      }
  &lt;/script&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>i replaced "popup" with "self". now only one child window open at a time instead of multi and working perfect.</p>
  
  <p><strong>but when i close child window, parent page is not refreshing.</strong> </p>
  
  <p>child window code as below</p>
  
  <pre><code>&lt;form id="form1" runat="server"&gt;
  &lt;input type="button" value="Refresh Parent" onclick="RefreshParent()" /&gt;
  &lt;script type="text/javascript"&gt;
      function RefreshParent() {
          if (window.opener != null &amp;&amp; !window.opener.closed) {
              window.opener.location.reload();
          }
      }
      window.onbeforeunload = RefreshParent;
  &lt;/script&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>please help me out</p>