Access html form element, inside iframe without id/name
<p>I have the following code-structure (nested HTMLs, although that probably doesn't make much of a difference)</p>

<pre><code>&lt;html&gt;
    &lt;body&gt;
        &lt;iframe&gt;
            &lt;html&gt;
                &lt;form id="loginForm" name ="loginFormName"&gt;
                    &lt;input id ="name" name ="username"&gt;
                    &lt;/input&gt;
                &lt;/form&gt;
            &lt;/html&gt;
        &lt;/iframe&gt;
    &lt;/body&gt;
&lt;/html
</code></pre>

<p>I tried it by accessing the input field via:</p>

<pre><code>document.getElementById("name");
document.loginFormName.username;
</code></pre>

<p>But I believe the iFrame hinders me to access the elements. However, somehow accessing the iFrame first:</p>

<p><code>document.getElementByTagName("iframe).getElementById("name");</code> </p>

<p>does not yield any results other than "undefined".</p>

<p>Help is much appreciated, I would like to auto-set the value of the input field and auto-submit the form. (form.submit). I have no preference regarding Javascript or JQuery.</p>