[thelist] CSS Based on Calendar Dates

Mike Combs mike at combsnet.com
Fri Feb 20 16:02:59 CST 2004


Why not put a small JavaScript in the head of your document that will load 
a second stylesheet in addition to the usual one?  If the JavaScript is 
external to the HTML page, then you can update it anytime you'd like 
without having to make any further changes to your HTML pages.

If the user's browser doesn't support JavaScript, they'll only lose the 
seasonal look, but not the primary stylesheet.

The script could be as simple as this pseudo-code:
-- get date
-- if between oct 5 and dec 31, cfile=Christmas.css
-- if between jan 1 and feb 14, cfile=valentines.css
-- if between feb 15 and oct 4, cfile=almostChristmas.css
-- if june 3, cfile=schoolsout.css
-- if cfile.css is not empty, load cfile.css

>From: "WL Murray" <warren at digital-crossroads.com>
>
>I'm working on an elementary school website and I'm looking for a way to =
>switch between stylesheets based on calendar dates (going through =
>themes) automatically (ie. seasons, last days of school and holidays).
>
>Can someone point me in the right direction?
>
>Thanks!!!
>
>Warren L.



More information about the thelist mailing list