Javascript or CSS that highlights table based on content?

hevnsnt

Lifer
Mar 18, 2000
10,868
1
0
Ok.. Sounds simple but I need some help

I have a table like this

12/14 | blah | Blah
12/15 | Blah | Blah
12/16 | Blah | Blah

I would like some sort of Javascript or CSS or something that will look at that table and highlight the row containing "today's" date..

Any help here? Thanks!
 

jgbishop

Senior member
May 29, 2003
521
0
0
Although this isn't a direct answer, the following article will at least show you how to shade the rows in a table using JavaScript:

Zebra Tables (at A List Apart)

You could certainly convert this code into something that tests the date, rather than just the row index. If you know that the row with the current date will always be first or last, that should be easy as well.
 

hevnsnt

Lifer
Mar 18, 2000
10,868
1
0
The table will be static, meaning today's date will never be first... :(


Oh.. And thanks for the link, reading it now!
 

hevnsnt

Lifer
Mar 18, 2000
10,868
1
0
If anyone comes by this later, and can help please do! (I am still looking for help!)
 

Kilrsat

Golden Member
Jul 16, 2001
1,072
0
0
The programmers wonder why you're trying to do this on a static page, instead of a dynamically generated one. The php/perl solution involves a simple loop and a single if, trying to do it after the fact just wastes time.
 

replicator

Senior member
Oct 7, 2003
431
0
0
Try this one. Dates are pretty anal across different browsers, so just take it as an example of something quick and dirty.
 

hevnsnt

Lifer
Mar 18, 2000
10,868
1
0
Originally posted by: Kilrsat
The programmers wonder why you're trying to do this on a static page, instead of a dynamically generated one. The php/perl solution involves a simple loop and a single if, trying to do it after the fact just wastes time.



I know I know.. The webserver that I am working with does not have any php/asp.. It does have perl however..