Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Location
    Lexington, KY
    Posts
    87

    HTML - Iframe Help

    What would be the proper method for setting up an iframe system in which the parent iframe's height increases or decreases as the height of the daughter iframe changes. If I worded this in a confusing manner please let me know for clarification.


  2. #2
    try this.

    Code:
    function autoResize(id){
        var newheight;
    
        if(document.getElementById){
            newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
    		
        }
        document.getElementById(id).height= (newheight) + "px";
    }

  3. #3
    Join Date
    Jun 2006
    Location
    Lexington, KY
    Posts
    87
    Thank you for the reply, I am assuming i should include script tags with this? Im sorry I am a little basic in the coding of websites, and should this be included with the parent frame or the daughter frame, or both?


  4. #4
    Join Date
    Apr 2008
    Location
    Seattle, WA
    Posts
    19
    The code looks like it's intended by be included in and called from the parent frame. What it does is take the id of the iframe, get its contained document body height, and set the iframe's own height to that same value.

    I use a very similar trick on my own site (http://luminotes.com/) but it's further complicated by the fact that the size of the iframe's contained document body changes as the user types! If that's what you're dealing with, then you'll need to attach to the appropriate events and call the above code whenever an event fires.
    Luminotes personal wiki notebook | http://luminotes.com/

Posting Permissions

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