Answer
Sep 16, 2006 - 04:41 PM
John, there seems to be no obvious way to achieve this, but I managed to get the following to work:This is the iframe element in the body section of the mother page:This is the javascript function that will be called when the page is loaded inside the iframe:function size_iframe(){x =document.getElementById("iframetest");y = frames.iframetest.document.getElementById("iframecontent");if (document.all) // IE problem; wont show clientHeight if style height hasn't been sety.style.height = "1px";margin = 30;x.style.height = parseInt(y.clientHeight + margin) + "px";}The script will set the HEIGHT of the iframe to that of the content of the child page. It has to add a margin (depends both of the child page and of the browser, but 30 should do).The only thing you NEED to do is to fit the actual content of the child page (test1.html) inside a DIV tag like this: test file to load inside the iframe
can be of variable height Otherwise, I couldn't get it to work. The BODY element doesn't seem to want to report its clientHeight.This example has been tested in IE6 and FF 1.5Hope it is useful, - if you want me to change it according to your needs, please say so.Jakob
can be of variable height Otherwise, I couldn't get it to work. The BODY element doesn't seem to want to report its clientHeight.This example has been tested in IE6 and FF 1.5Hope it is useful, - if you want me to change it according to your needs, please say so.Jakob
Add New Comment