Skip to content

Instantly share code, notes, and snippets.

@roachhd
Last active April 16, 2026 15:11
Show Gist options
  • Select an option

  • Save roachhd/7bfa522b3d9409fae2df to your computer and use it in GitHub Desktop.

Select an option

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>
@senpaistream787-commits
Copy link
Copy Markdown

Using JavaScript to dynamically load different CSS files based on the day of the week is a clean idea. It keeps the logic lightweight and avoids unnecessary complexity in the main codebase.

This kind of modular thinking is really useful in web development, especially when building user-friendly interfaces where adaptability and smooth experience matter a lot—similar to how platforms like Senpai Stream focus on simple and responsive UI behavior.

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