OT: Dynamically calculating the height of an HTML document

Apologies for the off-topicness, this is really a Javascript question,
but I figure someone here may know how to do it.

I need to dynamically add a "footer" to an already existing HTML page,
sight unseen.

Currently, I insert a <div> element just before the </body> end tag, and
this works most of the time. But, sometimes the <div> is rendered to
the right of a table _if_ the entire page is laid out in one big table.

I have been unable to come up with a way to force my content into the
lower left hand corner, even using absolute positioning CSS directives
(in one case, the table extends beyond what the browser thinks the
"bottom" of the page is).

I'm looking for a way to inspect the DOM to figure out the height of all
of the existing content on the page, then I figure I can absolute
position with a left margin of 0 and a top margin of <whatever the
height of existing content is>.

I tried getting document.body.offsetHeight, but this returns 0 in both
FF and IE.

Anyone have any ideas how to do this, without resorting to manipulating
any of the existing HTML?

Thanks,
Wes

without manipulating the html. Well you could throw it out completely
which is never a wrong move when facing a tabular layout but i digress.

Your best bet is to insert at the end of the body element the footer
content and just above the footer a clear (ie:

<div class="clear">&nbsp;</div>
<div id="footer">
blah blah
</div>

with css:

#footer{
float:left;
}

.clear{
clear:both;
height:0;
font-size:0;
}

-K

Keynan Pratt wrote:

without manipulating the html. Well you could throw it out completely
which is never a wrong move when facing a tabular layout but i digress.

Your best bet is to insert at the end of the body element the footer
content and just above the footer a clear (ie:

<div class="clear">&nbsp;</div>
<div id="footer">
blah blah
</div>

with css:

#footer{
float:left;
}

.clear{
clear:both;
height:0;
font-size:0;
}

-K

Keynan,

Thanks this works well. So I guess a one-table layout comes with an
implied float: left.

Wes

You might try examining the HTML with Firebug to see if there's
something else in the DOM that has a height attribute you can use.
Don't feel bad if you find nothing, even Gmail uses <br /> tags for
additional spacing in certain "empty" places.