| | |
Table row color altering based on conditions
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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:
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)
.row1 {background-color: black}; .row2 {background-color: white};
HTML and CSS Syntax (Toggle Plain Text)
foreach (rowelement) { if ($rowname = 'row1') $rowname = 'row2'; else $rowname = 'row1'; print "<tr class=$rowname>"; }
If you know ASP, you can save other daniweb members from idiots like me by helping out in this forum.
Visit this thread if your username starts with one of the following letters: B D F H J L N P R T X Y Z.
Visit this thread if your username starts with one of the following letters: B D F H J L N P R T X Y Z.
![]() |
Similar Threads
- Change the focus to table row (JavaScript / DHTML / AJAX)
- Add / remove table row. javascript (JavaScript / DHTML / AJAX)
- selecting html table row for deletion (JavaScript / DHTML / AJAX)
- dynamic dropdowm list and mysql (PHP)
- Alternating backgrounds? (JavaScript / DHTML / AJAX)
- how to print table background color? (HTML and CSS)
- HTML 3.2 table background color (HTML and CSS)
- Print 5 records per table row (see script) (Perl)
Other Threads in the HTML and CSS Forum
- Previous Thread: Floats going above clears
- Next Thread: IE7 css compatibility
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 xml xsl





