Accessing text field within iframe from parent document and store for use
<p>I have two documents - <strong>main.html (parent document)</strong> and <strong>enterKey.html (child document)</strong>.</p>

<p>Within main.html</p>

<pre><code>&lt;script&gt;
...
&lt;/script&gt;
&lt;iframe id="key" src="enterKey.html"&gt;&lt;/iframe&gt;
</code></pre>

<p>Within enterKey.html:</p>

<pre><code>&lt;input id="sbox" type="text"&gt;
</code></pre>

<p>I am trying to access the value entered in sbox for use in <strong>main.html</strong>. But because the user will be continuously updating <strong>sbox</strong> I need for the updates to be reflected in <strong>main.html</strong>. </p>

<p>For example if the user types into sbox "hello worlx" then corrects it a second later to "hello world" then the change must be reflected immediately in the parent document.</p>

<p>How can this be achieved?</p>

<p>I've been looking at using <code>document.getElementById('key').contentWindow.sbox</code> but don't know how to use it in the context of my example.</p>

<p>Many thanks in advance!</p>
