[thelist] Coloring specific table cells based on a variable

Peter-Paul Koch gassinaumasis at hotmail.com
Mon Dec 4 05:54:36 CST 2000


>Here's my task:  I have a site with 3 sections (let's say home, library,
>programs).  I'm creating a table of contents for the site and I would like
>to write javascript function which will color the table cell - which
>corresponds to the current section the user is in -- with a background 
>color
>of white.  All other cells would stay the global color.

Do it in CSS, no JavaScript needed. Give the BODY a class of home, library, 
programs, etc. then do

BODY.home TD {background-color: #ffffff;}
BODY.library TD
BODY.programs TD

which means 'any TD inside a BODY with class="home"' (or library or 
programs).

Much simpler.

ppk
_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com





More information about the thelist mailing list