Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/05/2011, 13:45
dalfeju
Invitado
 
Mensajes: n/a
Puntos:
Pregunta Script para autoajustar iframe no funciona en Chrome

Lo que quiero hacer es autoajustar el alto de un iframe con respecto a su contenido, encontré este script que lo hace a la perfección en Internet Explorer y Mozilla, pero no en Chrome ¿alguna idea? También me di cuenta de que para que funcione, tanto el iframe como la página deben estar alojados en el mismo lugar. Entonces, ¿cómo hago?

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Página</title>
  5.  
  6. <script language="JavaScript">
  7. <!--
  8. function calcHeight() {
  9.     var the_height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
  10.     document.getElementById('the_iframe').height = the_height + "px";
  11. }
  12. //-->
  13. </script>
  14.  
  15. </head>
  16.  
  17. <iframe width="500px" id="the_iframe" onLoad="calcHeight();" src="pagina2.html" scrolling="NO" frameborder="0" height="1px"></iframe>
  18. </body>
  19. </html>

Última edición por dalfeju; 15/05/2011 a las 14:02