...

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



devonrs
05-14-2007, 09: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

thanks!

devonrs
05-14-2007, 10: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:
http://www.codingforums.com/showthread.php?t=10886

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

parent.document.body.scrollHeight-166

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...

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

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum