View Full Version : variable height of an iframe based on top and bottom locations

05-14-2007, 08:50 PM
Hey, this works in firefox, but not IE - I was wondering if anyone knows of an alternative. I have an iframe that i want to position say 100px from the top and 50px from the bottom of the page, if put top:100px; bottom:50px; height:*; it works fine in firefox but IE doesn't seem to recognize * as a valid value for height. is there something else i can do? I also tried 100% hoping it would just use up "100% of it's available space" but it lines up with the top and then goes beyond the bottom of the page.

you can see the site in question at www.mzcontrols.com


05-14-2007, 09:16 PM
okay, i figured out one way to do it, but if you resize the window the frame doesn't resize unless you hit refresh because it's javascript that determines the height upon loading..

i used code from this post:

but changed frmname.document.body.scrollHeight+20 to


so it's basically 100% minus the height of my header and footer. though i'd still like a better way, that will resize with the window if the browser is resized.. anyone?

thanks in advance...

05-15-2007, 12:12 AM
You can use the onresize (http://www.w3schools.com/jsref/jsref_onresize.asp) event to run the javascript without refreshing the page.

05-15-2007, 12:38 AM
brilliant, thank you!

05-15-2007, 03:35 PM
works great in IE and Firefox, but doesn't work in Opera, any idea why?