KE5EHI
08-11-2005, 04:01 PM
Okay, here's the problem. I have this site I'm currently building, http://www.towpc.com/ke5ehi/, and I have an iFrame for the main content (controlled by the menu on the left - item's with a ' * ' haven't been made yet). When you load the satellite page, it resizes fine, but when you load the chaser-on-the-road > on-the-road page (which has the switch content menu), the javascript only sizes the iFrame to the collapsed menu state, so if you expand any of the items, the page is cut-off. Any help would be appreciated (I'm still not that good on some of this :) )
This is the onload handler for each page within the iFrame:
<body onload="if (parent.adjustIFrameSize)
parent.adjustIFrameSize(window);" topmargin=0 leftmargin=0>
This is the javascript for the main page:
<script type="text/javascript">
function adjustIFrameSize (iframeWindow) {
if (iframeWindow.document.height) {
var iframeElement = document.getElementById
(iframeWindow.name);
iframeElement.style.height = iframeWindow.document.height + 'px';
iframeElement.style.width = iframeWindow.document.width + 'px';
}
else if (document.all) {
var iframeElement = document.all[iframeWindow.name];
if (iframeWindow.document.compatMode &&
iframeWindow.document.compatMode != 'BackCompat')
{
iframeElement.style.height =
iframeWindow.document.documentElement.scrollHeight + 'px';
iframeElement.style.width =
iframeWindow.document.documentElement.scrollWidth + 'px';
}
else {
iframeElement.style.height =
iframeWindow.document.body.scrollHeight + 'px';
iframeElement.style.width =
iframeWindow.document.body.scrollWidth + 'px';
}
}
}
</script>
This is the onload handler for each page within the iFrame:
<body onload="if (parent.adjustIFrameSize)
parent.adjustIFrameSize(window);" topmargin=0 leftmargin=0>
This is the javascript for the main page:
<script type="text/javascript">
function adjustIFrameSize (iframeWindow) {
if (iframeWindow.document.height) {
var iframeElement = document.getElementById
(iframeWindow.name);
iframeElement.style.height = iframeWindow.document.height + 'px';
iframeElement.style.width = iframeWindow.document.width + 'px';
}
else if (document.all) {
var iframeElement = document.all[iframeWindow.name];
if (iframeWindow.document.compatMode &&
iframeWindow.document.compatMode != 'BackCompat')
{
iframeElement.style.height =
iframeWindow.document.documentElement.scrollHeight + 'px';
iframeElement.style.width =
iframeWindow.document.documentElement.scrollWidth + 'px';
}
else {
iframeElement.style.height =
iframeWindow.document.body.scrollHeight + 'px';
iframeElement.style.width =
iframeWindow.document.body.scrollWidth + 'px';
}
}
}
</script>