Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
cambio de tamaño automático de iframe por ID

Tengo problemas con el cambio de tamaño automático (altura) de iFrames por id. ¿Hay alguna manera de generar automáticamente el tamaño del iframe (altura) en función de las id? El código actual funciona, pero desafortunadamente, solo captura el primer iframe y quiero mostrar los iframes según la altura original. Cualquier sugerencia, aportes, muchas gracias. para todas las respuestas

Debajo del código, lo que he intentado:

 <table width="100%" align="center" border="0"> <tr><td valign="top" align="left"> <table border="0"> <tr><td align="center"> <iframe id="menu" onLoad=" calchght();" src="./xxxxxx.html" scrolling="no" frameborder="0"></iframe> </td></tr> </table> </td> <td width="100%" valign="top"> <iframe id="pageframe" onLoad=" calchght();" src="./xxxxxx.html" scrolling="no" frameborder="0"></iframe> </td></tr> </table> <script language="JavaScript"> function calchght() { //find the height of the page var heightframe= document.getElementById('pageframe').contentWindow. document.body.scrollHeight; //change the height of the iframe document.getElementById('pageframe').height= heightframe; } </script> <script language="JavaScript"> function calchght() { //find the height of the page var heightframe= document.getElementById('menu').contentWindow. document.body.scrollHeight; //change the height of the iframe document.getElementById('menu').height= heightframe; } </script>

Código adicional, pero esto está verificando todos los iframes que no se basan en la identificación

 var framefenster = document.getElementsByTagName("iFrame"); var auto_resize_timer = window.setInterval("autoresize_frames()", 400); function autoresize_frames() { for (var i = 0; i < framefenster.length; ++i) { if(framefenster[i].contentWindow.document.body){ var framefenster_size = framefenster[i].contentWindow.document.body.offsetHeight; if(document.all && !window.opera) { framefenster_size = framefenster[i].contentWindow.document.body.scrollHeight; } framefenster_size = (framefenster_size+10); framefenster[i].style.height = framefenster_size + 'px'; } } }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda