PDA

View Full Version : Expandable iFrame



Andys
18-05-2007, 06:46 PM
Anyone got a code for an expandable iframe?

Will +rep :]

Moved by opensourcehost (Forum Moderator) from Web Designing: Please post in the correct forum next time, thanks http://habboxforum.com/images/smilies/smile.gif.

Aflux
18-05-2007, 06:49 PM
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
var f = document.getElementById("mainframe");
function resize() {
var h = "";
var w = "";
if (f.contentDocument) {
h = f.contentDocument.documentElement.offsetHeight + 20 + "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 + 5 + "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();
}
//]]>
</script>
<iframe name="middle" id="mainframe" src="home.php" width="495PX" frameborder="0" allowtransparency="yes" scrolling="no"></iframe>

Andys
18-05-2007, 06:55 PM
Cheers, Adam.

Want to hide these adverts? Register an account for free!