Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-28-2007, 10:27 AM #1
- Join Date
- Jun 2007
- Thanked 0 Times in 0 Posts
coloring html table cell based on cell value
hello friends, i have problem here, please help me.
i have a jsp page in that jsp page i am displaying the data retrived from the database(mysql). i am displaying data in table format.
noe the problem is i want to color table cell based on cell value. that is if table cell consists value say "met" then i want to color that table cell in green color. like this for other cell.
first i want check the value and then select bgcolor for that cell accordingl .
i need working code for this . or sample code for checking condition in <td> tag.
please help me.its urgent.
thanks and regards
06-28-2007, 10:51 AM #2
- Join Date
- Aug 2006
- Cardiff, UK
- Thanked 2 Times in 2 Posts
I'd suggest that when you place the value in the cell from the database, you also assign a class (maybe with the same name) at the same time so you'd end up with:
You can then style the background for that in CSS:Code:<td class="met"><p>Met</p></td>
If anyone asks my boss, this counts as work, okay?