Results 1 to 2 of 2

Thread: scrollHeight/offsetHeight (Firefox/IE) Iframes

  1. #1
    Join Date
    Jul 2006
    Posts
    4

    scrollHeight/offsetHeight (Firefox/IE) Iframes

    I found a problem in javascript between IE and Firefox when trying to adjust the height of iframes depending on the content but I don't know how to fix it. Obviously IE doesn't work with offsetHeight because when I change the document.body.scrollHeight; to document.body.offsetHeight; the iframes resize in the content in Firefox but do not resize in IE. When I use document.body.scrollHeight; Internet Explorer will resize the iframes but Firefox will not. I do not understand why this is? scrollHeight (IE), offsetHeight(Firefox)... WIERD - Anyone know a solution here's the code:

    Code:
        <script type="text/javascript">
        function autofitIframe(id)
        {
        var the_height=
            parent.document.getElementById(id).contentWindow.document.body.scrollHeight;
    
          //change the height of the iframe
          parent.document.getElementById(id).height=the_height;
        }

  2. #2
    Join Date
    Jun 2004
    Posts
    173
    Try document.body.parentNode.clientHeight.

Similar Threads

  1. iframes
    By evilelvis in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 10 May 2006, 04:05 AM
  2. page containing iframes
    By sj700 in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 24 Nov 2005, 07:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •