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

Discussion in 'Javascript' started by douglasc, Nov 21, 2003.

  1. douglasc

    douglasc Guest

    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
    douglasc, Nov 21, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Jorden
    Replies:
    1
    Views:
    591
    laurie
    Aug 19, 2003
  2. Phillip Roncoroni
    Replies:
    14
    Views:
    1,085
    Toby A Inkster
    Apr 5, 2004
  3. kaston3
    Replies:
    2
    Views:
    1,743
    kaston3
    Jul 18, 2006
  4. John Dalberg
    Replies:
    4
    Views:
    782
  5. RMZ
    Replies:
    2
    Views:
    184
    David Mark
    Aug 2, 2007
Loading...

Share This Page