Dynamic updating of background-color within table cells

Discussion in 'HTML' started by Craig Taylor, Dec 7, 2006.

  1. Craig Taylor

    Craig Taylor Guest

    I'm dynamically creating a table in JS based upon an Ajax response. As
    part of that response I'm wanting to "row"-a-size it so that
    alternating light and dark columns show up.

    My JS extract to assign the css is as follows:
    (just added td cell )
    elem.setAttribute( "class", "cssClassName" );

    And in the css I have the appropriate class definitions for (in this
    case "dark" and "light" (td.light, td.dark) ).

    This works in FireFox just fine and IE renders the cells appropriately
    but is ignoring the setting of the class attribute.

    Any thoughts?

    - Craig Taylor
    Craig Taylor, Dec 7, 2006
    #1
    1. Advertising

  2. Craig Taylor

    Craig Taylor Guest

    Craig Taylor wrote:
    > I'm dynamically creating a table in JS based upon an Ajax response. As
    > part of that response I'm wanting to "row"-a-size it so that
    > alternating light and dark columns show up.
    >
    > My JS extract to assign the css is as follows:
    > (just added td cell )
    > elem.setAttribute( "class", "cssClassName" );
    >
    > And in the css I have the appropriate class definitions for (in this
    > case "dark" and "light" (td.light, td.dark) ).
    >
    > This works in FireFox just fine and IE renders the cells appropriately
    > but is ignoring the setting of the class attribute.


    Found the problem - IE doesn't honor a "setAttribute" on the class -
    you need to explicitly reference it via a elem.className = "class" to
    set the class property.

    *grumbles* - IE...
    Craig Taylor, Dec 7, 2006
    #2
    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. =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?=

    updating GridView cell background color

    =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?=, Aug 22, 2007, in forum: ASP .Net
    Replies:
    11
    Views:
    3,794
    =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?=
    Aug 29, 2007
  2. fig000
    Replies:
    0
    Views:
    4,545
    fig000
    Sep 6, 2004
  3. Kamaljeet Saini
    Replies:
    0
    Views:
    410
    Kamaljeet Saini
    Feb 13, 2009
  4. Michael McClune

    Dynamic table data background color in NN

    Michael McClune, Jan 13, 2004, in forum: Javascript
    Replies:
    7
    Views:
    133
    kaeli
    Jan 14, 2004
  5. Replies:
    1
    Views:
    267
    marss
    Feb 14, 2007
Loading...

Share This Page