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

element just before the end tag, and
this works most of the time. But, sometimes the
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 .

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:

 
blah blah

with css:

#footer{
float:left;
}

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

-K

Keynan P. 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.

Unfortunately, this is submitted HTML and I don’t have control over it
before I need to add my footer.

Wes

Keynan P. 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:

 
blah blah

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

On 1/17/08, Wes G. [email protected] wrote:

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 .

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?

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
tags for
additional spacing in certain “empty” places.


Greg D.
http://destiney.com/