Skip to content

Instantly share code, notes, and snippets.

@roachhd
Last active January 11, 2020 09:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roachhd/7bfa522b3d9409fae2df to your computer and use it in GitHub Desktop.
Save roachhd/7bfa522b3d9409fae2df to your computer and use it in GitHub Desktop.
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')
}
dSS.link.rel = "stylesheet";
dSS.link.type = "text/css";
dSS.link.href = dSS.names[ dSS.number ] + ".css";
document.getElementsByTagName('head')[0].appendChild( dSS.link );
<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">');
//-->
</script>
<noscript>
<link rel="stylesheet" type="text/css" href="default.css">
</noscript>
@apsrcreatix
Copy link

👏

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