Different Stylesheets for Different Days of the Week using Javascript

Name your css files accordingly: Saturday.css, Friday.css, Sunday.css, etc…


If JavaScript is disabled in the browser, it will revert back to the default.css file.

<script type="text/javascript"> 
dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; 
dayNumber = new Date().getDay(); 
document.writeln('<link rel="stylesheet" type="text/css" href="' + dayNames[dayNumber] + '.css">'); 
<link rel="stylesheet" type="text/css" href="default.css"> 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s