title: How to access a method of parent window of an Iframe [Chrome browser ]
body: <p>I tried many times and many ways to call the method from inside the <code>iframe</code> while not yet successful to do so. please see below,  </p>
  
  <ol>
  <li><p><code>main.html :</code> consisting the two iframe   </p></li>
  <li><p>iframe-1 linked with a index.html from where i want to call a method of main.html or want to change the src of second iframe.</p></li>
  </ol>
  
  <p><strong>main.html</strong></p>
  
  <pre><code>&lt;html&gt; 
      &lt;head&gt; &lt;/head&gt;
      &lt;body&gt;
       &lt;iframe id="iframe-1" src="index.html"&gt;&lt;/iframe&gt;
       &lt;iframe id="iframe-2" &gt;&lt;/iframe&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;html&gt; &lt;head&gt; 
  &lt;script type="text/javascript"&gt;
   $(document).ready(function(){
      // How to access the method of main.html and change the iframe src
   });
  &lt;/script&gt;
  &lt;/head&gt; &lt;body&gt;
      ......
  &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  
  <p>Note : tried <code>parent.methodName()</code>, <code>window.parent.methodName()</code> not working   </p>
  
  <p>@EDIT : success on IE &amp; MOZILLA but getting error on Chrome ( Cannot call method 'getElementById' of undefined )</p>