Hi,
I messed around with this for quite a while -- it seems to be easy in Firefox and Opera (latest versions for Windows) but IE is notoriously uncooperative.
This is what I came up with and it's working in all three I tested it in (FF 3.0.1, Op 0.51, IE 7.0.xxxx), with the test page I worked up like your description.
Give it a test and let me know if it works for you -- I'm curious
<script type="text/javascript">
function get_computed_style ( node, styleProperty ) {
var computedStyle = null;
if ( typeof window.getComputedStyle != "undefined" ) {
computedStyle = window.getComputedStyle(node,null); // Moz
} else if ( typeof node.currentStyle != 'undefined' ) {
computedStyle = node.currentStyle; // IE
}
return computedStyle[styleProperty];
}
window.onload = function () {
var frame_height = 0;
var html = document.getElementsByTagName('html').item(0); // Compliant browsers
if ( ( frame_height = html.offsetHeight ) < document.body.offsetHeight ) {
var body = document.getElementsByTagName('body').item(0); // IE browsers
frame_height = document.body.offsetHeight;
frame_height += parseInt( get_computed_style( body, 'marginTop' ).match( /\d+/ ) );
frame_height += parseInt( get_computed_style( body, 'marginBottom' ).match( /\d+/ ) );
frame_height += 20; // for god knows what value IE adds to its document
}
parent.window.document.getElementById("WindowMain").height = frame_height;
};
</script>
Hope it helps
...