Click to See Complete Forum and Search --> : iFrame height
I need to use an iFrame on part of my site.
Is there a way to make the iFrame 'dynamically size' (height) to avoid the scroll bars for long pages?
Thanks.
Theoretically, this will work more cross-browser:
<script language="JavaScript" type="text/JavaScript">
function setHeight() {
docheight = document.body.scrollHeight;
document.getElementById("myiframe").style.height= docheight+"px";
}
</script>
</head>
<body onload="setHeight();">
<iframe id="myiframe"></iframe>
Thanks again, but not exactly what I was trying to do.
I really want the iFrame to dynamically expand/contract to match the page being loaded into it. Like a DIV would do when you change its innerHTML.
Would overflow-y work?
Thanks again.
alert (document.body.scrollHeight);
will return values in IE, Mozilla, NN, and Opera, at least. I believe that the onload statement in the iframe is what causes it not to work in non IE browsers.
This works, except that it generates an Object Required error.
<iframe style="width:expression(main.document.body.scrollWidth);
height:expression(main.document.body.scrollHeight);"
name="main" id="main" width="500" src="home.htm"
scrolling=no frameborder=1></iframe><p>
<a href="Calendar.cfm" target="main">
If anyone can expalin the error we will be all set.
You can see it at
http://testmän.nu/
Did you fail to realize that this thread was 8 1/2 months old? :confused:
I was hoping someone could explain my error.
Anyway, did he ever get an answer?
Originally posted by dwd
I was hoping someone could explain my error.Then start a new thread, please.