Advertisement
2_2002-2004 Miscellaneous #126433

Dual Scrollbars in IE When using IFrames

Anyone who has used IFRAMES in IE may have noticed several problems with them. One big one, is that if you were to include an iframe that extends to the side of your parent page, and the iframe has a scroll bar, then both the iframe and the parent would have a scroll bar. Very confusing. This script resizes the iframe so that it doesn't have a scroll bar. Problem solved...

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
stick this on your page....
<script language="javascript">
function checkiFrame() {
  if ((document.all('imain').readyState=="complete")) {
		if (document.frames('imain',0).document.body.scrollHeight > 500) {
		document.all('imain').style.height = document.frames('imain',0).document.body.scrollHeight;
		}else{
		document.all('imain').style.height = 500
		}
	}
}
</script>
it's fired by this in your iframe...
<iframe.... onreadystatechange="checkiFrame()">
Original Comments (3)
Recovered from Wayback Machine