DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > DHTML Scripts
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 31.05.2007, 23:47
jadeite100 jadeite100 is offline
Neuer Benutzer
 
Join Date: 31.05.2007
Posts: 2
Default

What is the difference between height, scrollHeight and style.height


Hi:
I have a IFrame called "dataFrame". Does anybody know the difference between
document.getElementById('dataFrame').height
and
document.getElementById('dataFrame').Document.body .scrollHeight;
and
document.getElementById('dataFrame').style.height

Quote:
function shrinkIFrame() {
var theFrame=document.getElementById('dataFrame');
var header,headerHeight,footer,navPrimaryMenu,navPrima ryMenuHeight,mainMenu2,iFrameHeight,mainMenu2Heigh t,wholeWindowHeight;
var totalHeight,differenceHeight;

if(theFrame){

theFrame.style.display="block"
if(theFrame.Document && theFrame.Document.body.scrollHeight)
{


header=parent.document.getElementById('Header2');
navPrimaryMenu=parent.document.getElementById('nav PrimaryMenu');
mainMenu2=parent.document.getElementById('mainMenu 2');

headerHeight = header.offsetParent.offsetHeight;
navPrimaryMenuHeight=navPrimaryMenu.scrollHeight;
mainMenu2Height=mainMenu2.scrollHeight;
wholeWindowHeight=document.body.offsetHeight;
iFrameHeight =theFrame.Document.body.scrollHeight;

totalHeight =headerHeight+mainMenu2Height+navPrimaryMenuHeight ;

differenceHeight = wholeWindowHeight - totalHeight;



//alert("differenceHeight: " + differenceHeight);

if (iFrameHeight > differenceHeight)
{
// 92 represent the row header, one row and the scrollbar
//alert("iFrameHeight > differenceHeight");
if (differenceHeight > 92)
{

theFrame.style.height=differenceHeight+ 'px';
}
else
{
alert("theFrame.height:"+theFrame.height+"theFrame .Document.body.scrollHeight:"+theFrame.Document.bo dy.scrollHeight);
alert("differenceHeight:"+differenceHeight+"theFra me.style.height:"+theFrame.style.height);

theFrame.height=theFrame.Document.body.scrollHeigh t;

}

}
else
{

theFrame.style.height = differenceHeight +'px';
}


}
if(theFrame.attachEvent){

theFrame.detachEvent("onload", readjustIframe)
theFrame.attachEvent("onload", readjustIframe)
}
}

}

Yours,
Frustrated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT +2. The time now is 08:39.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.