Javascript: 100% Height em Iframes
Data: 20 Jun 07, 11:50
Será que alguém me consegue ajudar?
Precisava de expandir um iframe em 100% de altura no browser (já que em comprimento ele dá). Funciona no Opera, mas nos outros browsers não (Firefox, Ie6, Ie7, Safari).
Este foi o código que descobri pela net:
No head:
< script type="text/javascript">
function autofitIframe(id)
{
if (!window.opera && !document.mimeType && document.all && document.getElementById)
{
parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
}
else if(document.getElementById)
{
parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
}
}
</script>
No body
<body id="home" onload="autofitIframe(main)">
No iframe:
<iframe src="index.php" width="100%" height="692" name="main" scrolling="no" frameborder="0" onload="autofitIframe('main')" style="margin: 0; padding: 0;"></iframe>
Editado: bom… troquei por frames –'