dynamic iframe

  • Started
  • Last post
  • 3 Responses
  • IheartQBN

    I'm trying to get my iframe to resize dynamically.

    I've got a header (150px), and a footer (50px), I want the header to stay at the top of the screen while the footer rests at the bottom and I want this to happen for each user that accesses the page. I want the Iframe to be inbetween the two and to act dynamically so that it resizes to the area between the header and footer. All content in the iframe will scroll but the main page will never scroll.

    I tried using a percent and a "*" for the iframe but it seems to want pixels.

    I've been trying to write something simple but it's not working out, could someone tell me if im on the right track, or give me some help with the correct way to write this.

    docheight = document.body.clientheigh
    t

    iframeheight = (docheight - 150)

    (i used 150 because that is the header and footer added together)

    and then just call iframeheight when inputting my height for the iframe, something like:

    iframe src="page.html" width=446 height=iframeheight

    Will this work if it's coded correctly? Has anyone got this to work a different way?

  • shannen0

    Why are you using an iFrame?

    Sounds like a simple frame set to me. To my knowledge, iFrames are absolute and will not do what you're going for.

    You could probably get some serious javascripting going on, but why?

  • kpl0

    you'd have an easier time making a dynamic div with scrolling content.

  • IheartQBN0

    thanks kpl