Filling out and submitting a form for a newly opened window
<p>What I'd like to do is open a new window, then submit the form in that new window after automatically filling out he form elements from the original window. Here is what I tried to do:</p>

<pre><code>var username = 'myuser';
var password = 'mypass';
var loginWindow = window.open('http://www.mysite.com/form.html', 'loginWindow');
loginWindow.document.getElementById('username').value=username;
loginWindow.document.getElementById('password').value=password;
loginWindow.document.form.submit();
</code></pre>

<p>This however does not work, and instead gives me the following error: "Result of expression 'loginWindow.document' [undefined] is not an object."</p>

<p>Is this even possible? Can jQuery solve this?</p>
