Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/04/2009, 05:17
Bernad
 
Fecha de Ingreso: enero-2009
Ubicación: Elche
Mensajes: 59
Antigüedad: 15 años, 3 meses
Puntos: 3
Respuesta: IFrame height auto resize

Hay muchos códigos en varias páginas, si buscas con Google los puedes encontrar.
Te pongo un ejemplo:
Código:
The Code
In the head of your document enter the following JavaScript code:

<script language="JavaScript">
<!--
function calcHeight()
{
  //find the height of the internal page
  var the_height=
    document.getElementById('the_iframe').contentWindow.
      document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('the_iframe').height=
      the_height;
}
//-->
</script>

and in the body create the iframe tag:

<iframe width="700" id="the_iframe" 
	onLoad="calcHeight();" 
	src="testing_page.shtml" 
	scrolling="NO" 
	frameborder="1" 
	height="1">
An iframe capable browser is 
required to view this web site.
</iframe>
Lo malo es que el scrollHeight no funciona igual en IE que en FF, vamos, que hay incompatibilidades, como suele ser habitual.

Estoy intentando encontrar una solución a esto, pero no la encuentro.
Prueba el código que te he puesto y si te funciona bien en varios navegadores nos lo dices.

Un saludo.