title: iframe auto-resizing by id's
body: <p>I'm having problems with auto resizing (height) of iFrames by id’s
  Is there a way to automatically generate the size of the iframe (height) based on the ids?
  The current code works, but unfortunately, it only captures the first iframe and I want to display the iframes based on the original height.
  Any suggestions, inputs, many thx. for all answers</p>
  <p>Below the code, what I have tried:</p>
  <pre><code>&lt;table width=&quot;100%&quot; align=&quot;center&quot; border=&quot;0&quot;&gt;
      &lt;tr&gt;&lt;td valign=&quot;top&quot; align=&quot;left&quot;&gt;
          &lt;table border=&quot;0&quot;&gt;
              &lt;tr&gt;&lt;td align=&quot;center&quot;&gt;
                  &lt;iframe id=&quot;menu&quot; onLoad=&quot; calchght();&quot; src=&quot;./xxxxxx.html&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;
              &lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
          &lt;/td&gt;
          &lt;td width=&quot;100%&quot; valign=&quot;top&quot;&gt;
          &lt;iframe id=&quot;pageframe&quot; onLoad=&quot; calchght();&quot; src=&quot;./xxxxxx.html&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;   
      &lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  
  
  &lt;script language=&quot;JavaScript&quot;&gt;
  function calchght()
  {
    //find the height of the page
    var heightframe=
      document.getElementById('pageframe').contentWindow.
        document.body.scrollHeight;
  
    //change the height of the iframe
    document.getElementById('pageframe').height= heightframe;
  }
  &lt;/script&gt;
  
  
  &lt;script language=&quot;JavaScript&quot;&gt;
  function calchght()
  {
    //find the height of the page
    var heightframe=
      document.getElementById('menu').contentWindow.
        document.body.scrollHeight;
  
    //change the height of the iframe
    document.getElementById('menu').height= heightframe;
  }
  &lt;/script&gt;
  </code></pre>
  <p>Additional code, but this is checking all iframes not based on the id’s</p>
  <pre><code>  var framefenster = document.getElementsByTagName(&quot;iFrame&quot;);
    var auto_resize_timer = window.setInterval(&quot;autoresize_frames()&quot;, 400);
    function autoresize_frames() {
      for (var i = 0; i &lt; framefenster.length; ++i) {
          if(framefenster[i].contentWindow.document.body){
            var framefenster_size = framefenster[i].contentWindow.document.body.offsetHeight;
            if(document.all &amp;&amp; !window.opera) {
              framefenster_size = framefenster[i].contentWindow.document.body.scrollHeight;
            }
                framefenster_size = (framefenster_size+10);
            framefenster[i].style.height = framefenster_size + 'px';
          }
      }
    }
  </code></pre>