alternate row color of table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mukeshrasm
    Contributor
    • Nov 2007
    • 254

    alternate row color of table

    Hi

    I want to print the table with alternate row color dynamically? How can I do that using javascript ?

    Thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    How are you printing the table? Show your code.

    To set the background colour, you can set a class or set the style.backgroun dColor property of each row. To alternate, just use odd for one colour and even for the other.

    Comment

    • mukeshrasm
      Contributor
      • Nov 2007
      • 254

      #3
      Originally posted by acoder
      How are you printing the table? Show your code.

      To set the background colour, you can set a class or set the style.backgroun dColor property of each row. To alternate, just use odd for one colour and even for the other.
      Table is generating dynamically from database and I want alternate row color of for the table. If you have code for that, please help me! ..

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by mukeshrasm
        Table is generating dynamically from database and I want alternate row color of for the table. If you have code for that, please help me! ..
        You don't need JavaScript for that. Just use the server-side language to set different alternating classes for each row.

        Comment

        Working...