Height Code doesnt work with FireFox

D

DaveO

Hi All

I found this code ( see below ) on the web and it works great in IE, but not
in FireFox.

What it does : if added to the head section of a html page that gets loaded
into my main iFrame, it resizes the height of the iFrame to fit the height
of the page being loaded into the iFrame ( with a minimum height of 900px )

I really don't understand javascript very much, and basically I just need to
get this 1 thing to work.

Could any kind individual please tell me how to modify this so it works in
IE and FireFox ?

A thousand Thank Yous for any attempts and assistance.

Regards
Dave


<script type="text/javascript">

function resizeToFit(that){

var objNode = (typeof(this.nodeName)=='undefined') ? that : this ;
var objIframe = window.parent.document.getElementById('resizeToFit');
var intScrollX, intScrollY, intWinWidth, intWinHeight, intMaxWidth,
intMaxHeight;
var intWhileCount = 0;
window.resizeTo(480, 900)
// sets the minimum frame size required

do{
// scroll the document by 1 pixel
window.scrollTo(1000,1);
// measure the scroll position
intScrollY = (document.all) ? document.body.scrollTop :
window.pageYOffset ;
// measure window size
intWinHeight = (document.all) ? document.body.offsetHeight :
window.innerHeight ;
// if the scroll position is not 0
if(intScrollY>0){
// make the window larger by 25px
window.resizeBy(0,25);
// make the iframe larger
if(objIframe!=null && !document.all) objIframe.style.height =
(objIframe.style.height=='') ? '64px' : (parseInt(objIframe.style.height) +
32) + 'px';
}
// count the steps
intWhileCount += 1;
}while((intScrollX>0 || intScrollY>0) && intWhileCount<900);
}

function waitToFit()
{
setTimeout("resizeToFit()",100);
}

onload = waitToFit;

</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top