Go Back   BioRUST Forums > Graphics Software & Support > HTML / PHP / ASP / JS

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-31-2007   #1 (permalink)
Registered User
 
Join Date: May 2007
Posts: 4

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
jadeite100 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 06-01-2007   #2 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,026

Send a message via MSN to notjustgraphics
I have a IFrame called "dataFrame". Does anybody know the difference between

Code:
document.getElementById('dataFrame').height
This returns the height of the entire object, in this case, the iframe named 'dataFrame' including margins and borders.

and

Code:
document.getElementById('dataFrame').Document.body.scrollHeight;
This returns the height of the viewable port of a scrollable element without margins and broder, in this case, the iframe named 'dataFrame'.

DOM:element.scrollHeight - MDC

and

Code:
document.getElementById('dataFrame').style.height
This returns the height of an element set through CSS such as a DIV.

Hope this helps.

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 08:47 PM.
Content Relevant URLs by vBSEO 3.2.0 RC7

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT