title: Access input field of parent page from within .js in an iframe on same domain
body: <p>I have a .js file that runs on a page and interacts with the data already there.  That .js file creates an iframe which loads another page that also has a .js file installed (both with GreaseMonkey).  I'm trying to make the .js file running in the iframe grab a var from the parent page.  Both are on the same domain, but it will not access the data.  Here's what I have:</p>
  
  <p>js1:</p>
  
  <pre><code>var myvar1 = document.getElementsByName('nameofinputfromparentpage')[0].value;
  </code></pre>
  
  <p>js2:</p>
  
  <pre><code>var myvar2 = parent.document.getElementsByID('page1').getElementsByName('nameofinputfromparentpage')[0].value;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>var myvar2 = myvar1 (or parent.myvar1 or window.myvar1 or a dozen other variances...)
  </code></pre>
  
  <p>I've tried pushing the var from js1 to js2 with something like: 
  <code>window.frames[iframeName].variableName</code> or using <code>contentDocument</code>/<code>contentWindow</code>.
  I just can't seem to get the syntax right to make it actually pull the data...</p>
  
  <p>So... the page source of the parent page has an input box, how do I get that info to be accessed in .js running in an iframe of another .js on the parent page?  Thank you everyone for your help!  :)</p>