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

Paul Novitski javascriptlist at dandemutande.org
Fri Jan 16 15:55:01 CST 2004


My first guess is that you're computing these locations before the page is 
fully rendered when the browser doesn't yet know the exact table 
dimensions.  If I'm right, try calling your repositioning function with 
onLoad().

Paul


At 01:50 PM 1/16/2004, you wrote:

>         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
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list