Calculating the available screen height with which to work

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I need assistance with calculating how many pixels I have to work with on
the vertical axis of a page:

I have three main sections in the page: a mastehead, an iframe and a div.
the masthead and iframe each have to be a particular height. what i want to
do is dynamically set the height of the div, so that the bottom of the div
is just visible above the bottom of the screen. I dont want there to be any
scrollbar on the right of the screen. the dive will have it's own scrollbar
if it's contents exceeds the height of the div.

I have tried to get the size righ, but it seems that nio matter how hard I
try I keep getting it wrong.

My code is as follows:

function setHeight()
{
var availableHeight = body.clientHeight;
var mastheadHeight = 123;
var iframeHeight = 200;
var topMargin = body.topMargin;
var bottomMargin = body.bottomMargin;
var availableY = availableHeight - logoHeight - iframeHeight -
bottomMargin - topMargin - 7;
alert(availableY);
resTree.style.height = availableY + "px";
//alert(availableY);
}


The "-7" is the height (pixels) that the div etends below the bottom of the
screen, thus causing a scroll bar to appear on the right. Can anyone tell
me if I am using the right properties to measure the space available on the
the screen?

Regards,

Vaughn




.



Relevant Pages

  • Overlaying divs while matching their baselines?
    ... I have a div containing an image 300 pixels in height: ... that its bottom line is positioned exactly at the bottom line of the image ... and that the two div's therefore remain 300 pixels in total height. ... of the second div and not resorting to making the image a background. ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: div tag help
    ... I want a div area that goes across the top of the page (which I can ... don't go "all the way to the bottom of the page" if the content is ... leans on ones page down button, because said browser can't go down any more. ... Where is the bottom of the "page" for an absolutely positioned div element? ...
    (alt.html)
  • Re: [Full-disclosure] Vulnerabilities in Google
    ... <div class='inner'> ... function loadLanguage(pkg, lang, level) { ... var file; ... var google = "http://vanillaresults.com/?q=";; ...
    (Full-Disclosure)
  • Thumbnail Viewer adjusting
    ... here is simple and compact image viewer script, I'm satisfied with it, but ... as a thumbnail), resize it dynamically for thumbnail, so this did not ... //write out HTML for Image Thumbnail Viewer plus loading div ... var ie=document.all &&!window.opera ...
    (comp.lang.javascript)
  • Re: A rotation of only 120 degrees
    ... So each team would play 7-9 games per season, ... Bottom 2 down from Division 1 ... Each division winner up from Div 3. ... Winners up from each Div 4. ...
    (rec.sport.soccer)