Log in

View Full Version : help me please i am in trouble



manju.msrit
06-26-2007, 08:58 AM
hi,
i have a jsp page, in this page i am displaying data retrieved from mysql database. Now the problem is i must color table cell based on cell value. how to implement this.please give me an sample or working code foe this problem.( any code is accepted) preferably html or javascript.
i.e
if cell value is "late" then display that cell in red color(cell bgcolor=red)
else
display the cell in green color
please help me.

Thanks ad Regards
Akash

Jas
06-27-2007, 12:21 AM
Something like this (in the head section)?


//query & pass values to JS
if(value == Late){
document.write("<style type='text/css'>td#yourcellid{background-color: #FF0000;}</style>");
}else{
document.write("<style type='text/css'>td#yourcellid{background-color: #00FF00;}</style>");
}

djr33
06-27-2007, 02:16 AM
I suggest just using JSP to set a style for the td element.