TradeNurkicNow
piss
- Joined
- Sep 16, 2008
- Messages
- 5,197
- Likes
- 679
- Points
- 113
Hey guys,
trying to build a website with at least an attempt at cross compatibility between firefox and IE.
So, one thing I've noticed is that they both treat body onLoad differently.
I've got an iframe and I'm changing its src to an html at a click of a button. The html it loads has an onLoad that tells the parent frame to change the iframe dimensions to match the content. This works fine, until you click the button more than once, at which point it will stay with the previously loaded dimensions. This ONLY happens in Firefox. IE works fine and the dimensions load properly. I can only assume it's due how firefox handles onload, or perhaps something to do with caching. I am pretty lost. Got any ideas, denny?
top page
loaded page
trying to build a website with at least an attempt at cross compatibility between firefox and IE.
So, one thing I've noticed is that they both treat body onLoad differently.
I've got an iframe and I'm changing its src to an html at a click of a button. The html it loads has an onLoad that tells the parent frame to change the iframe dimensions to match the content. This works fine, until you click the button more than once, at which point it will stay with the previously loaded dimensions. This ONLY happens in Firefox. IE works fine and the dimensions load properly. I can only assume it's due how firefox handles onload, or perhaps something to do with caching. I am pretty lost. Got any ideas, denny?
top page
Code:
<a href="foo.html" target="iframeID">click</a><br>
<iframe src="" id="iframeID" width="100%" height="0"></iframe>
loaded page
Code:
<script language="JavaScript" type="text/javascript">
function resize()
{
var PageHeight = foo.scrollHeight;
parent.document.getElementById('iframeID').style.height=PageHeight;
var PageWidth = foo.scrollWidth;
parent.document.getElementById('iframeID').style.width=PageWidth;
}
</script>
<html>
<body id="foo" onLoad="resize()">
blah blah blah
</body>
</html>

