Jump to content

Internet Explorer Variable iFrame Height


Jaden07

Recommended Posts

Hi,I'm having problems with varying my iframe height in Internet Explorer. If you view my website (www.cityvoices.co.uk) in either Google Chrome or the latest Mozilla FireFox brower, they display the content perfectly fine. However, if you view the website through Internet Explorer, you'll see that the iframe doesn't expand to the height of the content. My current iframe code is:<script type="text/javascript"> //<![CDATA[window.onload = function() {var f = document.getElementById("mainframe");//Sets iframe idfunction resize() { //Starts resize functionvar h = "6000";var w = "";if (f.contentDocument) {h = f.contentDocument.documentElement.offsetHeight + 5 + "px";// can't find anything for Opera and Firefox that works for the width. OffetWidth doesn't work right either.(f.contentDocument.documentElement,"").getPropertyValue("width");} else if (f.contentWindow) {h = f.contentWindow.document.body.scrollHeight + 0 + "px";} else {return;}f.setAttribute("height",h);f.parentNode.setAttribute("height",h);}if (window.addEventListener) {f.onload = resize;} else if (f.attachEvent) {f.attachEvent("onload", resize);} else {return;}resize(); //starts resize function that was coded further up the code}//]]></script><iframe name="mainframe" id="mainframe" src="i_home.html" width="100%" frameborder="0" allowtransparency="yes" scrolling="No"></iframe>And this all goes into the <body> tags.I'm a novice when it comes to coding so if you have an answer, please explain as easily as possible haha :)Thanks,Jaden

Link to comment
Share on other sites

Err, have you explored more modern solutions (besides iFrames), such as AJAX?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...