title: Javascript: Add Onload function to POST Popup page
body: <p>First post here. I have a problem I CANNOT solve.
  I have a popup window (window.open). Let's say that opens "1.php". It has a form that submits to "2.php" after a button whose Id is "Submit" is clicked.</p>
  
  <p>It is easy to add an Onload function toa  popup:</p>
  
  <pre><code>open_window = window.open("1.php", "",'width=100,height=100,location=0');   
  open_window.addEventListener("load", function(){//do something}, false);
  </code></pre>
  
  <p>But I WANT something different. I want this:</p>
  
  <pre><code>open_window = window.open("1.php", "",'width=100,height=100,location=0');
  
  // a lot of thing happen. then after certain action, another function does this:
  
  open_window.document.getElementById("Submit").click(); //submits to "2.php"
  
  
  open_window.addEventListener("load", function(){//DO SOMETHING AFTER 2.PHP HAS LOADED}, false);
  </code></pre>
  
  <p>This last command does not work. I have 1.php that is already loaded. then submit the form to 2.php and insert an OnLoad to 2.php. The form DOES submit but onload does not execute.</p>
  
  <p>Any ideas? i tried the equivalent with iframe and it works</p>
  
  <p>I appreciate any help.</p>
  
  <p>Danny</p>