IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Are you sure offsetHeight doesn't work in IE?
offsetHeight is a Microsoft extension copied by Mozilla, not a W3W standard. So if it works in Firefox is should work in IE.

Jay
New Yep.
testframe.html:
<html>\r\n  <body>\r\n    <iframe id="daFrame" src="testcontent.html" height="100px" width="100%" frameborder="0" marginheight="0" marginwidth="0"></iframe>\r\n    <div style="border: solid 3px green;" width="100%">The bottom content.</div>\r\n  </body>\r\n</html>
\r\n\r\ntestcontent.html:
<html>\r\n  <head>\r\n     <script type="text/javascript" language="javascript">\r\nfunction foo()\r\n{\r\n    window.parent.document.getElementById("daFrame").height = document.getElementById("daBody").offsetHeight + 16;\r\n}\r\n    </script>\r\n  </head>\r\n  <body id="daBody" onLoad="foo();">\r\n1<p>\r\n2<p>\r\n3<p>\r\n4<p>\r\n5<p>\r\n6<p>\r\n7<p>\r\n8<p>\r\n9<p>\r\n10<p>\r\n  </body>\r\n</html>
\r\n\r\nLoad testframe.html. In Firefox, the frame resizes on load to the size of the content. In IE, it doesn't.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New nevermind
Its true but it doesn't really matter now does it?

offsetHeight is read-only in IE ATFM

[link|http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/offsetheight.asp|http://msdn.microsof.../offsetheight.asp]
--
Chris Altmann
Expand Edited by altmann Oct. 19, 2005, 03:09:09 PM EDT
New Try scrollHeight instead
[link|http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/scrollheight.asp|http://msdn.microsof.../scrollheight.asp]
--
Chris Altmann
New Scroll
This might do the trick, but it will not compute correctly during the onload event (ie doesn't calculate them until after they are drawn).

\n   window.parent.document.getElementById("daFrame").height =\n      document.getElementById("daBody").scrollHeight - \n         document.getElementById("daBody").scrollTop + 16;\n

New WTF.
That worked...

I did an enumeration and there was always a 0 in scrollHeight in IE. *fbog*

Thanks.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Hmm, well it certainly doesn't work
I see why it doesn't work. Both are described as returning the height of an object. But Firefox is returning the height of the page as it would be displayed on it's own, IE is returning the height the frame reserves for drawing the object. Not quite the same thing.

I'm not sure what you can do to get around this. One idea would be to put the contents of the testContent file into a table or div that fills the entire page. Then pull the size of that. But I have no idea if that would actually work.

Jay
     Getting content height in IE - (admin) - (10)
         apt-get install debian -NT - (drewk) - (1)
             Wonder if that can be scripted using VBScript... - (inthane-chan)
         Easy. - (Another Scott)
         Are you sure offsetHeight doesn't work in IE? - (JayMehaffey) - (6)
             Yep. - (admin) - (5)
                 nevermind - (altmann)
                 Try scrollHeight instead - (altmann)
                 Scroll - (ChrisR) - (1)
                     WTF. - (admin)
                 Hmm, well it certainly doesn't work - (JayMehaffey)

Ohh... they're still working.
45 ms