Archive for the ‘HTML’ Category.

IFrame - Height “auto”

Pour permettre à une IFrame d’adapter sa hauteur à son contenu, il est nécessaire d’utiliser un JavaScript…

<iframe onLoad="calcHeight(this)" src="Default.aspx" WIDTH="100%" HEIGHT="100%" frameborder="0" scrolling="no">
</iframe>
<script type="text/javascript" language="JavaScript">
function calcHeight(the_iframe) {
    the_iframe.style.height = the_iframe.contentWindow.document.body.scrollHeight; //changement de la hauteur
    the_iframe.style.width = the_iframe.contentWindow.document.body.scrollWidth; //changement de la largeur
}
</script>

Source: Auto-increase frame height

  • Share/Save/Bookmark