...

View Full Version : coloring html table cell based on cell value



manju.msrit
06-28-2007, 10:27 AM
hi

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
manjunath

butlins
06-28-2007, 10:51 AM
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:

<td class="met"><p>Met</p></td>
You can then style the background for that in CSS:

td.met {background-color:#FF0000;}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum