title: JavaScript window.opener call parent function
body: <p>I am trying to call a javascript function defined in a parent from a child window.  I have two files like this:</p>
  
  <p>Parent:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Test&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function foo () {
  alert ("Hello from parent!");
  }
  function doStuff () {
  var w = window.open("testa.html");
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="button" value="open" onClick="doStuff();" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And child:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Test A&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function get() {
  window.opener.foo();
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="button" value="Call Parent" onClick="get();" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I can not, for the life of me, call the function foo from the child process.  I thought this should be possible with the window.opener object, but I can not seem to make this work.  Any suggestions?</p>