[Javascript] offsetTop inside a TD (IE 5 and 6)

Peter Brunone peter at brunone.com
Fri Jan 16 15:50:19 CST 2004


	This isn't strictly Javascript related, so smack me if you think
I'm too far off-topic.  Also, it's limited to up-level Internet
Explorer, since that's my current development platform.

	I've been summing the offsetTop and offsetHeight of say,
Object1, to position the style.top of Object2 directly below it.  This
works just fine until Object1 is in a table cell.

	When the TD is valign="top", I have no problems.  However, when
the valign is middle or bottom, Object1's distance from the top of the
TD is added to the final style.top value of Object2.  

Here are two mockups of the situation.

***********************************************************
Example A:

---------Top of cell (valign middle)-----------



        Object1 in middle of cell


        Object2 starts right below the bottom (about 1/2 cell-height
below where it should).
---------------- Bottom of cell ---------------


Example B:

---------Top of cell (valign bottom)-----------





        Object1 at bottom of cell
---------------- Bottom of cell ---------------




        Object2 starts down here (almost a full cell-height below
Object1)

**************************************************************

Any thoughts on what this strange valign-related value is?

Regards,

Peter Brunone





More information about the Javascript mailing list