I'm building my first website and I have a main element which is supposed to stretch to the height of the content of the iFrame. I need a click in NavBox.htm (also iFrame'd into the Index page) to display SubFolder/SubPage.htm (mostly plaintext) inside the main iFrame of Index.htm and call a function in Index.htm that changes the element's height depending on the length of the sub-page.
It works when a longer page is called, but if a shorter page is called, it actually grows by the padding size (20px) I added (if I take off the padding it just stays the same size). I'm pretty sure it's a simple mistake in my syntax, but I can't get the height to recalculate with a new page inside the element.
On Index.htm I have the following function that changes the element height:
function frm_onload(frmname) {
frmname.frameElement.height = frmname.document.body.scrollHeight+20;
}
Further down is the actual iFrame call:
<iframe id="Center" width=98%; LANGUAGE=javascript ONLOAD="return frm_onload(Center)" marginwidth="0" marginheight="0" frameborder="0" ></iframe>
On the the NavBox.htm child page I have a link that changes the content of the element:
<a href="SubFolder/SubPage.htm" target="Center" onclick="document.getElementById('Center').src=SubFolder/SubPage">SubPage</a>
So if I'm thinking straight there's either something I'm not understanding from the function or I need the link in NavBox to do more. Thanks very much for any help you guys can provide!