Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/01/2009, 06:55
gso88
 
Fecha de Ingreso: enero-2009
Mensajes: 7
Antigüedad: 15 años, 4 meses
Puntos: 0
Respuesta: Redimensionar Iframe en Firefox

Hola y muchas gracias por responder tan rápido. Lo habia hecho como tu lo habias dicho pero me sigue sin funcionar.
Mira lo que tengo puesto y no me funciona:

En el html he hecho dos script:

Cita:
<script>
function getWindowData(n,i){
var ifr=document.getElementById(i).contentWindow.docum ent || document.getElementById(i).contentDocument;
var widthViewport,heightViewport,xScroll,yScroll,width Total,heightTotal;
if (typeof window.frames[n].innerWidth != 'undefined'){
widthViewport= window.frames[n].innerWidth;
heightViewport= window.frames[n].innerHeight;
}else if(typeof ifr.documentElement != 'undefined' && typeof ifr.documentElement.clientWidth !='undefined' && ifr.documentElement.clientWidth != 0){
widthViewport=ifr.documentElement.clientWidth;
heightViewport=ifr.documentElement.clientHeight;
}else{
widthViewport= ifr.getElementsByTagName('body')[0].clientWidth;
heightViewport=ifr.getElementsByTagName('body')[0].clientHeight;
}
xScroll=window.frames[n].pageXOffset || (ifr.documentElement.scrollLeft+ifr.body.scrollLef t);
yScroll=window.frames[n].pageYOffset || (ifr.documentElement.scrollTop+ifr.body.scrollTop) ;
widthTotal=Math.max(ifr.documentElement.scrollWidt h,ifr.body.scrollWidth,widthViewport);
heightTotal=Math.max(ifr.documentElement.scrollHei ght,ifr.body.scrollHeight,heightViewport);
return [widthViewport,heightViewport,xScroll,yScroll,width Total,heightTotal];
}
function resizeIframe(ID,NOMBRE){
document.getElementById(ID).height=null;
document.getElementById(ID).width=null;
window.location='#';//necesario para safari
var m=getWindowData(NOMBRE,ID);
document.getElementById(ID).height=m[5];
document.getElementById(ID).width=m[4]+22;
}
function addEvent(obj, evType, fn, useCapture){

if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);

} else if (obj.attachEvent){
obj.attachEvent("on"+evType, fn);

} else {
obj['on'+evType]=fn;
}
}
window.onload=function(){
resizeIframe('pp','pp');
addEvent(document.getElementById('pp'), 'load', function(){resizeIframe('pp','pp');}, false);
}
</script>
El segundo script:

Cita:
<script>
function getWindowData(n,i){
var ifr=document.getElementById(i).contentWindow.docum ent || document.getElementById(i).contentDocument;
var widthViewport,heightViewport,xScroll,yScroll,width Total,heightTotal;
if (typeof window.frames[n].innerWidth != 'undefined'){
widthViewport= window.frames[n].innerWidth;
heightViewport= window.frames[n].innerHeight;
}else if(typeof ifr.documentElement != 'undefined' && typeof ifr.documentElement.clientWidth !='undefined' && ifr.documentElement.clientWidth != 0){
widthViewport=ifr.documentElement.clientWidth;
heightViewport=ifr.documentElement.clientHeight;
}else{
widthViewport= ifr.getElementsByTagName('body')[0].clientWidth;
heightViewport=ifr.getElementsByTagName('body')[0].clientHeight;
}
xScroll=window.frames[n].pageXOffset || (ifr.documentElement.scrollLeft+ifr.body.scrollLef t);
yScroll=window.frames[n].pageYOffset || (ifr.documentElement.scrollTop+ifr.body.scrollTop) ;
widthTotal=Math.max(ifr.documentElement.scrollWidt h,ifr.body.scrollWidth,widthViewport);
heightTotal=Math.max(ifr.documentElement.scrollHei ght,ifr.body.scrollHeight,heightViewport);
return [widthViewport,heightViewport,xScroll,yScroll,width Total,heightTotal];
}
function resizeIframe(ID,NOMBRE){
document.getElementById(ID).height=null;
document.getElementById(ID).width=null;
window.location='#';//necesario para safari
var m=getWindowData(NOMBRE,ID);
document.getElementById(ID).height=m[5];
document.getElementById(ID).width=m[4]+22;
}
function addEvent(obj, evType, fn, useCapture){

if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);

} else if (obj.attachEvent){
obj.attachEvent("on"+evType, fn);

} else {
obj['on'+evType]=fn;
}
}
window.onload=function(){
resizeIframe('pp2','pp2');
addEvent(document.getElementById('pp2'), 'load', function(){resizeIframe('pp2','pp2');}, false);
}
</script>
Y en el html las llamadas del iframe las hago así:

Cita:
<iframe name="pp2" id="pp2" src="noticias.html" frameborder="0" scrolling="no"></iframe>

<iframe name="pp" id="pp" src="dia.html" frameborder="0" scrolling="no"></iframe>
Pero no sé porque solo me redimensiona uno u otro... A ver si podrias decirme porque falla. Muchas gracias de nuevo