943,829 Members | Top Members by Rank

Ad:
Jul 14th, 2009
0

Table row color altering based on conditions

Expand Post »
How do alternate table row colours dynamically using css only? Else with javascript? Can i use them inside struts iterate tag?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ritu_kr is offline Offline
8 posts
since Jul 2009
Jul 14th, 2009
0

Re: Table row color altering based on conditions

What do you mean by dynamically alternate row colours? Are you generating the html for the rows dynamically? If so, you'll have to dynamically indicate the class of the rows too. Example, in your css:
HTML and CSS Syntax (Toggle Plain Text)
  1. .row1 {background-color: black};
  2. .row2 {background-color: white};
Then in the script used to dynamically create the table, alternate between printing the row1 and row2 class:
HTML and CSS Syntax (Toggle Plain Text)
  1. foreach (rowelement) {
  2. if ($rowname = 'row1') $rowname = 'row2';
  3. else $rowname = 'row1';
  4. print "<tr class=$rowname>";
  5. }
Reputation Points: 70
Solved Threads: 15
Posting Whiz
kanaku is offline Offline
378 posts
since Jan 2007
Jul 14th, 2009
0

Re: Table row color altering based on conditions

The rows are added dynamically.
1. No jsp is involved.
2. Server side html is used.

The code you have written are which elements?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ritu_kr is offline Offline
8 posts
since Jul 2009
Jul 15th, 2009
0

Re: Table row color altering based on conditions

Just use simple JavaScrip here, it will better.
Reputation Points: 11
Solved Threads: 1
Light Poster
dipak_passion is offline Offline
34 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Floats going above clears
Next Thread in HTML and CSS Forum Timeline: IE7 css compatibility





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC