Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically change iframe size based on iframe content

Status
Not open for further replies.

Kindon

Programmer
Apr 19, 2001
54
0
0
US
I have an iframe that contains a form. The form area changes in size dynamically depending on user options. When the form gets too big, scrollbars show up. I want the iframe to dynamically get bigger if the content overflows the boundry of the page.

With a style I can set overflow to hidden to make the scrollbars go away. Or I could just set the iframe attribute scrolling = no.

Is there an even to capture when the page overflows? Would I then have to resize the width or height of the iframe. That seems like a lot of static settings. Is there a way to get it to resize automatically?

If not, how should this be done?

What about using a table and using JavaScript to change out the innerHTML with dynamic data from a hidden iframe? Any thoughts?

I am locked into only IE 5.5 and 6.x users so I do not have multi-browser issues.
 
What about a javascript function to get the scrollHeight and scrollWidth of the document within the iframe and apply those values to the iframe. Call that function from the 'body onload' and iframe resize' events.

 
(No good reason for the single quotes in that last sentence. Heheheh. Is there *really* no way to edit posts here?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top