Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    coloring html table cell based on cell value

    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

  • #2
    Regular Coder
    Join Date
    Aug 2006
    Location
    Cardiff, UK
    Posts
    141
    Thanks
    15
    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:
    Code:
    <td class="met"><p>Met</p></td>
    You can then style the background for that in CSS:
    Code:
    td.met {background-color:#FF0000;}
    If anyone asks my boss, this counts as work, okay?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •