Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

html with css

Status
Not open for further replies.

Yarka

Technical User
Jan 14, 2007
192
ES
hi,
i have .css as:

...

.statusPENDING { font-family: arial,serif; font-size: 8pt; background-color: #ACACAC; }
.statusOK { font-family: arial,serif; font-size: 8pt; background-color: #33FF00; }

...

and I am working with html que use this .css
I need have 2 different colors of the .statusOK (for exemple red and green) depending of the first character of the line.
It use cgis, but I dind't have to change it, only I can change css and html files.
How can I do it?

Thanks.
 
You'll need Javascript or some server-side language like your CGI's to check the first letter of the text, and alter the classname accordingly.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
How can I do it with Javascript?

Thanks.
 
You'll want to go to the JS forum here forum216 for specifics, but you'll need to pass the string to the substr function to get the first character of the string, and then compare that to which ever value you specify and change the classname accordingly. So you'll need two statusOk classes. one for the green and one for the red.

.statusOKgreen { font-family: arial,serif; font-size: 8pt; background-color: #33FF00; }

.statusOKred { font-family: arial,serif; font-size: 8pt; background-color: #FF3300; }









----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top