Javascript: 100% Height em Iframes
Calendário de artigos
S | T | Q | Q | S | S | D |
---|---|---|---|---|---|---|
voltar ao mês actual | ||||||
01 | 02 | 03 | ||||
04 | 05 | 06 | 07 | 08 | 09 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
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:
No body< 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>
<body id="home" onload="autofitIframe(main)"></div> No iframe:Margarida RebeloEditado: bom... troquei por frames<iframe src="index.php" width="100%" height="692" name="main" scrolling="no" frameborder="0" onload="autofitIframe(NULL, 'main')" style="margin: 0; padding: 0;"></iframe>
Comentários