Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/01/2011, 15:23
mtpa
 
Fecha de Ingreso: marzo-2010
Mensajes: 49
Antigüedad: 14 años, 1 mes
Puntos: 0
Pregunta iframe que se ajusta al tamaño de html

Hola de nuevo a la comunidad.

Tengo un iframe de mi sitio web, este iframe tiene la opcion a adaptarse al alto del contenido. como hago esto? de la siguiente manera:

PASO 1
JAVASCRIPT PARA ADAPTAR IFRAME AL CONTENIDO:

Código:
// JavaScript Document

var intento;
function ajustar(){
if(document.getElementById('inicio').height>0){clearTimeout(intento);return;}
document.getElementById('inicio').height=document.getElementById('inicio').contentWindow.document.body.scrollHeight;
intento=setTimeout('ajustar()',500);
}
PASO 2
En el body
Código HTML:
<body onload="ajustar()" > 

PASO 3
Código HTML:
<iframe id="inicio" src="index-iframe.htm" width="630" scrolling="no" height="0" frameborder="0"></iframe> 
con estos 3 pasos el iframe llamado INDEX-IFRAME.HTM se carga en la pagina principal. AHI TODO VA BIEN,

....PERO....ese iframe tiene hypervinculos o links, el problema es este: Al hacer click sobre el link se carga sobre el iframe, vamos bien....pero este segundo iframe no se adapta al contenido....

COMPRENDEN?

El primer iframe tiene un alto de 600px, el segundo iframe tiene un alto de 320px. por lo tanto cuando se carga el segundo iframe, se carga dejando un vacio o mejor dicho en blanco el resto del area restante.

¿¿¿COMO PUEDO HACER PARA QUE EL SEGUNDO IFRAME QUE SE CARGA SOBRE EL PRIMERO TAMBIEN SE ADAPTE AL CONTENIDO???

SALUDOS Y ESPERO ME AYUDEN.