I had to write a work around for the code i found here:
http://www.webmasterworld.com/forum91/3429.htm
The code works in firefox and I just thought some minor tweaks and it would work in ie7. Well, apparently in ie7 the resize event gets called when each of the line in the if statement get executed. So, ie7 goes into a nice loop.Code:function resize(){ var frame = document.getElementById("frame1"); var htmlheight = document.body.parentNode.scrollHeight; var windowheight = window.innerHeight; if ( htmlheight < windowheight ) { document.body.style.height = windowheight + "px"; frame.style.height = windowheight + "px"; } else { document.body.style.height = htmlheight + "px"; frame.style.height = htmlheight + "px"; } }
I wrote a workaround below that seems to work. However, anybody know a more graceful besides using a timer?
Code:<script type="text/javascript"> //<![CDATA[ function wait() { if (document.getElementById("wait").value == "f") { document.getElementById("wait").value = "t"; resize(); } else { self.setTimeout("change()",500); } } function change() { document.getElementById("wait").value = "f"; } function resize(){ //http://www.webmasterworld.com/forum91/3429.htm var frame = document.getElementById("gets"); /*frame is a div*/ var htmlheight = document.body.parentNode.scrollHeight; /*window.innerHeight; for FF*/ var windowheight = document.documentElement.clientHeight; //div#main, div#dpspane, div#main_tabs, div#case_tabs,div#footer if ( htmlheight < windowheight ) { document.body.style.height = windowheight + "px"; document.getElementById("gets").style.height = windowheight + "px"; //document.getElementById("main").style.height = windowheight + "px"; } //end if else { document.body.style.height = windowheight + "px"; document.getElementById("gets").style.height = windowheight + "px"; //document.getElementById("main").style.height = windowheight + "px"; } } window.onresize = wait; //]]> </script>




Reply With Quote