Advertisement
3_2004-2005 Miscellaneous #144977

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 Samenvatting: 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.

Broncode
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()">
Originele reacties (3)
Hersteld van de Wayback Machine