Skip to content

Instantly share code, notes, and snippets.

Last active January 11, 2020 09:09
What would you like to do?
script to set a different CSS sheet for each day of the week
var dSS = {
names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
number: new Date().getDay(),
link: document.createElement('link')
} = "stylesheet"; = "text/css"; = dSS.names[ dSS.number ] + ".css";
document.getElementsByTagName('head')[0].appendChild( );
<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">
Copy link


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment