Connecting Tech Pros Worldwide Help | Site Map

Is it possible to get the width of table cell(s) that have been dynamically built via JavaScript?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 12:01 PM
douglasc
Guest
 
Posts: n/a
Default Is it possible to get the width of table cell(s) that have been dynamically built via JavaScript?

Goal:

To build a horizontal floating menu that matches the first row (header
row) of my dynamically built table (to include text and cell
height/width - needs to match exactly). I have accomplished 90% of
this task by extracting the text and building the row in my floating
menu header and placing the floating menu where it needs to be.
However, I'm having a problem aligning the table (<TD></TD>) cells
because of my dynamically built table.


Scenario:

I have a table that is built dynamically. Before it is displayed, I
format the table row data (code that adds text/deletes rows etc…),
which alters the width of all the table cells (via JavaScript). We'll
call this (for lack of a better phrase)
"pre_floater_table_format_code."

I then loop through the DOM (<TD></TD>) in the first row of the table
to get the text and width from each cell (using offsetWidth and/or
clientWidth) and assign the text and cell width(s) to variables that I
use to build my floating menu with. We'll call this (for lack of a
better phrase) "get_cell_text_width_code."


Problem:

The problem is that once the table is built (and before it is altered
by the "pre_floater_table_format_code") it seems as though my
"get_cell_text_width_code" reads the un-processed table cell width(s)
and sets these variables to the un-processed width values. The
"pre_floater_table_format_code" runs much earlier than the
"get_cell_text_width_code." So why wouldn't the
"get_cell_text_width_code" read the cell width(s) after they've been
adjusted by the "pre_floater_table_format_code?" Does this make
sense? Anyone have any recommendations? Alternative solutions?



Regards,

Douglas

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.