Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/07/2010, 12:46
ZyklonB8
 
Fecha de Ingreso: julio-2010
Mensajes: 3
Antigüedad: 13 años, 9 meses
Puntos: 0
Div auto ajustable en funcion del iframe

Hola.

Me gustaria saber como se hace para ajustar el tamaño de un DIV en funcion del tamaño de la web que se carga en un iframe dentro del DIV.
El contenido varia en funcion de la web que se pone el en iframe por seleccion.
a.html tiene 10 lineas mientras b.html tiene 500 lineas
¿O se debe hacer de otra forma?

Pego codigo
Código:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function url1(){
	ifrm = document.getElementById("ifrm");
	ifrm.src="a.html";
}
function url2(){
	ifrm = document.getElementById("ifrm");
	ifrm.src="b.html";
}
</script>
<style type="text/css">
div.foo{
	position:relative;
	width:800px;
	height:auto;
	left:50%;
	margin-left: -400px;
	border: 2px solid black;
}
</style>
</head>
<body>
<a href="#" onclick="url1()">Url1</a> <a href="#" onclick="url2()">Url2</a> 
<div class="foo">
<iframe id="ifrm" width="100%" height="100%" scrolling="no" frameborder="0"> </iframe>
</div>
</body>
</html>

Última edición por ZyklonB8; 22/07/2010 a las 12:55