Foros del Web » Creando para Internet » HTML »

iframes ayuda, quiero saber si se puede!

Estas en el tema de iframes ayuda, quiero saber si se puede! en el foro de HTML en Foros del Web. hice una pagina con iframes, en si el diseño me quedo muy bien en lo que cabe, de igual forma la organizacion, este es el ...
  #1 (permalink)  
Antiguo 30/01/2008, 18:17
Avatar de cooosmos  
Fecha de Ingreso: marzo-2007
Ubicación: mexico
Mensajes: 54
Antigüedad: 17 años, 1 mes
Puntos: 4
iframes ayuda, quiero saber si se puede!

hice una pagina con iframes, en si el diseño me quedo muy bien en lo que cabe, de igual forma la organizacion, este es el link
http://clubbycooosmos.com/web/

la pagina consta de dos iframes uno que le llame menulink y otro que se llama centro1, bueno lo que keria saber si es posible es que cuando llame al iframe que va en el centro, este se adapte al lo largo del contenido,
se que eso se soluciona activando
Código:
scrolling="auto"
pero lo que si me gustaria claro si se puede es que la opcion
Código:
height=
se pueda poner automaticamente, y que no aparezca la barra que simplemente se ajuste sola...

cuando entren la pagina principal le sale los scrollin, y el otro que funciona es el de "Memorias / DDR / Flash Drive / MP3" ahi se ven la diferencia, le sobra mucho espacio.. porque sino la principal la tendria que hacer mas grande y bueno es todo un caso esto...


hay forma de hacer eso??? agradeceria mucho su ayuda
  #2 (permalink)  
Antiguo 31/01/2008, 02:24
Avatar de Mosiah  
Fecha de Ingreso: mayo-2002
Ubicación: Vitoria - Madrid
Mensajes: 229
Antigüedad: 21 años, 11 meses
Puntos: 0
Re: iframes ayuda, quiero saber si se puede!

Hola,
prueba esto:

Código:
	<script type="text/javascript">
		function setIframeHeight(iframeName) {
		  //var iframeWin = window.frames[iframeName];
		  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
		  if (iframeEl) {
		  iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
		  //var docHt = getDocHeight(iframeWin.document);
		  // need to add to height to be sure it will all show
		  var h = alertSize();
		  var new_h = (h-148);
		  iframeEl.style.height = new_h + "px";
		  //alertSize();
		  }
		}

		function alertSize() {
		  var myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    myHeight = document.body.clientHeight;
		  }
		  //window.alert( 'Height = ' + myHeight );
		  return myHeight;
		}
	</script>
...
<body onload="setIframeHeight('ifrm');" onresize="setIframeHeight('ifrm');">
Espero que te sirva.

Salu2
  #3 (permalink)  
Antiguo 31/01/2008, 10:57
Avatar de cooosmos  
Fecha de Ingreso: marzo-2007
Ubicación: mexico
Mensajes: 54
Antigüedad: 17 años, 1 mes
Puntos: 4
Re: iframes ayuda, quiero saber si se puede!

Hola Mosiah te agradezco la ayuda que me proporcionaste, pero no se que estoy haciendo mal, no me esta funcionando, no tengo claro si se tiene que cambiar las medidas del iframe, en el codigo le puse el nombre de mi iframe, pero sigue con lo mismo, tengo revueltas mis ideas agradeceria que le heches un ojo al codigo y me dijeras en donde estoy mal, talvez me este aprovechando de la ayuda que me ofreces pero ya lo intente y no funciona....
Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Propuesta Bancarios</TITLE>
<link href="archivos/estilobancafondo.css" rel="stylesheet" type="text/css" />
aqui llamo el script 
<script type="text/javascript">
		function setIframeHeight(miniChat) {
		  //var iframeWin = window.frames[iframeName];
		  var iframeEl = document.getElementById? document.getElementById(miniChat): document.all? document.all[miniChat]: null;
		  if (iframeEl) {
		  iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
		  //var docHt = getDocHeight(iframeWin.document);
		  // need to add to height to be sure it will all show
		  var h = alertSize();
		  var new_h = (h-148);
		  iframeEl.style.height = new_h + "px";
		  //alertSize();
		  }
		}

		function alertSize() {
		  var myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		    //IE 4 compatible
		    myHeight = document.body.clientHeight;
		  }
		  //window.alert( 'Height = ' + myHeight );
		  return myHeight;
		}
	</script></HEAD>
aqui lo cargo en el body
<BODY onload="setIframeHeight('ifrm');" onresize="setIframeHeight('ifrm');" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0"><DIV align=center>
<TABLE width=781 border=0 cellPadding=0 cellSpacing=0 background="http://www.forosdelweb.com/images/fondos/spacer.png">
  <TBODY>
  <TR>
    <TD align=middle 
    background="http://www.forosdelweb.com/images/computadoras.jpg" 
    colSpan=2><table width="781" border="0" background="http://www.forosdelweb.com/images/fondos/background.gif">
      <tr>
        <td width="775"><div align="center"><span class="style5">Aqui todo lo relacionado a los servicios que prestan  - a los clientes- y demas pendejadas que kieran</span></div></td>
      </tr>
      
    </table>
      </TD></TR>
  
  <TR>
    <TD width=198 height=836 vAlign=top bgcolor="#FFFFFF">
      <TABLE cellSpacing=0 cellPadding=0 width=198 border=0>
        <TBODY>
        <TR>
          <TD width="198" colSpan=2 bgcolor="#FFFFFF"><IMG height=25 alt="" 
            src="http://www.forosdelweb.com/images/computacion.jpg" 
            width=197 border=0></TD>
        </TR>
        <TR>
          <TD height=27 colSpan=2 align=middle bgcolor="#FFFFFF">
            <DIV align=left><img src="http://www.forosdelweb.com/images/sistemaspccopia.jpg" width="197" height="102"></DIV></TD></TR>
        <TR>
          <TD colSpan=2 bgcolor="#FFFFFF"><IMG height=15 alt="" 
            src="http://www.forosdelweb.com/images/cotizacion_de_pc.gif" 
            width=197 border=0></TD>
        </TR>
        <TR>
          <TD colSpan=2 bgcolor="#FFFFFF"><IMG height=25 alt="" 
            src="http://www.forosdelweb.com/images/equipos.jpg" 
            width=197 border=0></TD>
        </TR>
        <TR>
          <TD 
          background="index.htm" 
          colSpan=2>
            <TABLE height=336 cellSpacing=0 cellPadding=0 width=198 border=0>
              <TBODY>
              <TR>
                <TD style="PADDING-LEFT: 36px" width=198 
                background="http://www.forosdelweb.com/images/actualizacion.jpg" 
                height=13><iframe 
      src="http://clubbycooosmos.com/web/enlaces/menulinksprincipal.html" name="mainFrame" width="140" height="470" 
      scrolling="No" frameborder="0" class="right" 
      id="mainFrame" style="BACKGROUND-COLOR: transparent" allowtransparency="allowtransparency">
                <div align="left">Chat.</div>
                </iframe></TD>
              </TR>
              </TBODY></TABLE></TD></TR>
        <TR>
          <TD colSpan=2 height=16><IMG height=16 alt="" 
            src="http://www.forosdelweb.com/images/accesorios.jpg" 
            width=197 border=0></TD>
        </TR>
        
        
        <TR>
          <TD colSpan=2 height=8>&nbsp;</TD>
        </TR>
        </TBODY></TABLE></TD>
    <TD vAlign=top width=583>
      <TABLE cellSpacing=0 cellPadding=0 width=583 border=0>
        <TBODY>
        
        <TR>
          <TD width="332" 
          height=155 vAlign=top><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="583" height="163" title="banner">
            <param name="movie" value="archivos/bancariosencabezado.swf">
            <param name="quality" value="high">
            <embed src="archivos/bancariosencabezado.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="583" height="163"></embed>
          </object></TD>
          </TR>
        </TABLE>
      <TABLE cellSpacing=0 cellPadding=0 border=0>
        <TBODY>
        <TR>
          <TD><TABLE border=0 cellPadding=0 cellSpacing=0 bgcolor="#FFFFFF">
            <TBODY>
              <TR>
                <TH width=16 align=middle bgcolor="#FFFFFF">&nbsp;</TH>
                <TH width=39 align=middle background="http://www.forosdelweb.com/images/fon01.gif" bgcolor="#FFFFFF">&nbsp;</TH>
                <TH align=middle width=505 
          background="http://www.forosdelweb.com/images/fon02.gif"> <div align="center"><span 
                  class="menu style5"><strong><font 
                  color="#cccccc">.:</font></strong></span> <strong>Bancarios   Computaci&oacute;n, S.A. de C.V</strong></div></TH>
                <TH align=middle width=15><IMG height=37 
            src="http://www.forosdelweb.com/images/fon03.gif" 
            width=15></TH>
                <TH width=9 align=middle bgcolor="#FFFFFF">&nbsp;</TH>
              </TR>
              <TR>
                <TD align=middle colSpan=5><IMG height=24 alt="" 
            src="http://www.forosdelweb.com/images/cursos_varios1.jpg" 
            width=583 border=0></TD>
              </TR>
              <TR>
                <TD vAlign=top align=middle 
          background="http://www.forosdelweb.com/images/cursos_de_computacion.jpg" 
          colSpan=5 height=344><DIV align="center">
                  <DIV align="center"></DIV>
                </DIV>
aqui el codigo donde llamo al iframe
               <iframe 
      id="miniChat" style="BACKGROUND-COLOR: transparent" name="miniChat" 
      src="http://clubbycooosmos.com/web/enlaces/centro1.html" frameborder="0" 
      width="582" scrolling="auto" height="580" allowtransparency="allowtransparency"></iframe><TD>
              </TR>
              <TR>
                <TD vAlign=top align=middle 
          colSpan=5 height=14><img height=14 alt="" 
            src="http://www.forosdelweb.com/images/cursos.jpg" 
            width=583 border=0 name=bottom2></TD>
              </TR>
            </TBODY>
          </TABLE>
          </TD>
        </TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=583 border=0>
        <TBODY>
        
        
        <TR>
          <TD width="583" colSpan=3 vAlign=top><IMG height=1 alt="" 
            src="http://www.forosdelweb.com/images/spacer.gif" 
            width=1 border=0></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=583 border=0>
        <TBODY>
        
        <TR>
          <TD width="331" 
          height=18 vAlign=top 
          background="http://www.forosdelweb.com/images/pc.jpg">
            <TABLE cellSpacing=0 cellPadding=0 width=583 border=0>
              <TBODY>
              <TR>
                <TD class=style5 style="PADDING-LEFT: 40px" vAlign=top 
height=18><div align="center" class="Estilo3">
                  <div align="center">** PRECIOS MAS IVA ** PAGO DE CONTADO   EFECTIVO ** VALIDO HASTA AGOTAR EXISTENCIAS ** 
                    SUJETO A CAMBIO SIN PREVIO   AVISO ** SE APLICAN RESTRICCIONES ** <br />
                    Todos los   Logotipos y Marcas son Propiedad de sus Respectivos Due&ntilde;os </div>
                </div></TD>
                <TD>&nbsp;</TD>
              </TR>
              <TR>
                <TD class=style5 style="PADDING-LEFT: 40px" vAlign=top 
height=18>
                  <DIV align=center><span class="Estilo1"><a href="#">Acerca   de Nosotros</a> | <a href="#">Contactanos </a>| &copy;Bancarioscomputacion2008 <br>
                  </span>                  .: <A href="http://www.clubbycooosmos.com" 
                  target=_self class=menu Estilo2>By Cooosmos </A> </DIV></TD>
        <TD></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD></TD>
    <TD></TD></TR>
  <TR>
    <TD height=2></TD>
  <TD></TD></TR></TBODY></TABLE>
</DIV></BODY></HTML>
  #4 (permalink)  
Antiguo 31/01/2008, 11:16
Avatar de Mosiah  
Fecha de Ingreso: mayo-2002
Ubicación: Vitoria - Madrid
Mensajes: 229
Antigüedad: 21 años, 11 meses
Puntos: 0
Re: iframes ayuda, quiero saber si se puede!

Hola cooosmos,

hoy te ayudo yo, o te intento ayudar jeje, y otro día me ayudaras tu :)

En el body, cuando llamas a las funciones en el onLoad y onResize, le tienes que pasar el id de tu iframe, en este caso sería 'miniChat'.
Yo lo he probado y si que me funciona, lo único que hasta que no se completa la carga se ven los scrolls. Podrías ocultar el iframe y mostrarlo en el onLoad...
Prueba a ver y ya me cuentas.

Salu2
  #5 (permalink)  
Antiguo 31/01/2008, 14:39
Avatar de cooosmos  
Fecha de Ingreso: marzo-2007
Ubicación: mexico
Mensajes: 54
Antigüedad: 17 años, 1 mes
Puntos: 4
De acuerdo Re: iframes ayuda, quiero saber si se puede!

hola, asi sera, cuando pueda te ayudare es un hecho!!!

mira ahora si que no se que mas esta mal... probe con lo que me diste

Código:
<body onload="setIframeHeight('miniChat');" onresize="setIframeHeight('miniChat');"> 
y mientras me respondias estuve viendo las posiblidades y logre solucionarlo, bueno aparentemente con esta funcion que igual lo mencionas en tu respuesta.... muchas gracias
Código:
 }

		window.onload = function() {
			setTimeout("setIframeHeight('miniChat')",400);
		} 
ahora el problema es que si se quita el scroll y aparentemente funciona bien, pero despues puse otras paginas con contenido mas extendido y no hace nada, no obtengo resultado, simplemente no se ven completas... se quedan en el tamaño inicial en que cargo la primera pagina...

http://clubbycooosmos.com/web aqui para que veas el ejemplo, el enlace activo que no funciona es el de "computadoras ensambladas" y el de memorias...

agradeceria otra vez tu ayuda.. claro si esta en tus posiblidades..
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:39.