SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2004
    Location
    UK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamically changing the iFrame height

    Iím trying to display a page inside an iFrame but I want the iFrame to dynamically change itís height in relation to the height of the page within.

    I have this bit of code in the iFrame Content page

    <script language=ĒJavaScriptĒ>
    parent.handleResponse(300);
    </script>
    and in the parent page

    <script type="text/javascript">
    function handleResponse(msg) {
    var x = document.getElementById("myframe");
    x.height = msg;
    }
    </script>
    Which passes the integer value of 300 to the function handleResponse and handleResponse then resizes the iFrame and everything works. But, I want to be able to change the 300 value to the height of the document which is proving a little more difficult.

    something like body.document.height, but I know it's not as simple as that. Iíve tried various different things like scrollHeight, client HeightÖand still no luck.

    I'd appreciate any help you can offer.

  2. #2
    SitePoint Member
    Join Date
    Sep 2004
    Location
    UK
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ** BUMP **

    Any help on this is appreciated guys, and I do mean any help

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    100 Post(s)
    Tagged
    4 Thread(s)
    It sounds like you're after the window.innerHeight value.


Bookmarks

Posting Permissions

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