| | |
Table row color altering based on conditions
Please support our HTML and CSS advertiser: $6.99 Domain Names at 1&1. Includes Free Privacy. Save Now!
![]() |
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
Views: 807 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 background beta browser browserproblems cart cascade center chrome code containers create css design div division divs dreamweaver drupal editor emailmarketing embed explorer fail firefox float font fonts format free frontpage google helprequired-urgent hosting hover html ide ie7 iframe image images input internet internetexplorer javascript js list login macbook map maps margin microsoft missing mozilla mp3 multimedia navigationbars newb object opacity opera override overwrite perl player pnginie6 position positioning prevent problem relative seo shopping strings studio style tables tag templates text theme tips translation url validation visual visualization w3c web webform website websitedesign windows7 word wordpress xhtml xml xsl youtube





