Dynamic updating of background-color within table cells

C

Craig Taylor

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
 
C

Craig Taylor

Craig said:
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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top