Dynamically resize IFrame?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Dynamically resize IFrame?

Hybrid View

  1. #1
    Chuck Guest

    Dynamically resize IFrame?


    Hello all.

    I have an IFRAME control inside of an HTML document. The content of the IFRAME
    is injected with some jscript code by using the Open(), write() and close()
    methods. The IFRAME is absolutely positioned and is floating.

    I would like to figure out how to make the IFRAME resizable so that no scrollbars
    ever appear. I have been trying to see if any of the properties of the IFRAME
    "tell" me that there are scrollbars, but so far I'm coming up empty.

    Any suggestions?

  2. #2
    Chuck Guest

    Re: Dynamically resize IFrame?


    Yes, haven't a conversation with myself.

    Isn't this funny? After posting this message, I finally figured out how to
    do what I was after. This was after spending a few brain cells every week
    thinking about how this might get done (it hasn't been a high priority item).


    The answer was this:
    var dF = document.all.myFrame //ref to iFrame control
    dF.style.display="block" // make visible
    dF.height=10000;
    dF.height = document.frames("myFrame").document.body.scrollHeight

    The initial setting of 10000 fixed a problem where the window wasn't tall
    enough initially, but if I displayed it again with the same text, it was
    the right size. The display was also required as this iFrame is only displayed
    in the onmouseover and hidden in onmouseout.

    -Chuck

    "Chuck" <curwiler@comcast.net> wrote:
    >
    >Hello all.
    >
    >I have an IFRAME control inside of an HTML document. The content of the

    IFRAME
    >is injected with some jscript code by using the Open(), write() and close()
    >methods. The IFRAME is absolutely positioned and is floating.
    >
    >I would like to figure out how to make the IFRAME resizable so that no scrollbars
    >ever appear. I have been trying to see if any of the properties of the IFRAME
    >"tell" me that there are scrollbars, but so far I'm coming up empty.
    >
    >Any suggestions?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center