title: What is the equivalent of window.opener without opening a new window?
body: <p>A library I am using gets a reference to the main window by adding this script to a popup window:
      var winMain=window.opener;</p>
  
  <p>This script lets the popup window access global variables from the window that opened it. Example:</p>
  
  <pre><code>&lt;select name=MonthSelector onChange="javascript:winMain.Cal.SwitchMth(this.selectedIndex);winMain.RenderCal();"&gt;
  </code></pre>
  
  <p>However this leaves me in an awkward position if I try to call some of these variables without opening a new window. (For instance, if I try to embed one of the calendars inside a div instead of a new window.)</p>
  
  <pre><code>  onChange="javascript:Cal.SwitchMth(this.selectedIndex);"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>  var winMain=window;
    onChange="javascript:winMain.Cal.SwitchMth(this.selectedIndex);"
  </code></pre>
  
  <p>Both don't seem to work.  Is there some way to get the current window's handle as a variable?  Or an I just doing something wrong?</p>
  
  <p><a href="https://stackoverflow.com/questions/3708151/how-to-get-the-main-window-handle-of-a-process-using-jscript">This question</a> appears similar to mine, but the answers don't work.</p>