On Apr 8, 9:56 am, RobG <[EMAIL PROTECTED]> wrote: > On Apr 8, 1:56 pm, "R. Rajesh Jeba Anbiah" > > <[EMAIL PROTECTED]> wrote: > > I'm just wondering if there is any easy way to find out the header > > (th) of the table column (td)? > > Say, > > ---------------------- > > | head1 | head2 | > > ---------------------- > > | r11 | r12 | > > ---------------------- > > | r21 | r22 | > > ---------------------- > > > Here, r22's heading is "head2" > > You need to know what relationship that the "header" cell has with the > table cell. In a table with one tbody and the "header" cells are just > the first row of the table (i.e. the header row is in the same > tableSectionElement as the table cell), then if td is the cell: > > var headerCell = > td.parentNode.parentNode.rows[0].cells[td.cellIndex]; > > If however the header cell is in a thead (which is a different > tableSectionElement), you will need an extra parentNode: > > var headerCell = > td.parentNode.parentNode.parentNode.rows[0].cells[td.cellIndex];
Superb. Thanks. -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/