Created
April 16, 2015 20:01
-
-
Save stnadmin/c1292141fcca7001978d to your computer and use it in GitHub Desktop.
In common.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" type="text/css" href="css/winter.css" id="siteCSS"/> | |
<script type="text/javascript"> | |
// Get current month | |
var currDate=new Date(); | |
var currMonth = currDate.getDate(); | |
// Month returned by getDate() is 0 to 11 so add 1 | |
currMonth = parseInt(currMonth) + 1; | |
// Based on month assign style sheet name | |
var newCSS = "default.css"; | |
if (currMonth >= 1) newCSS = "winter.css"; // Month is January or greater | |
if (currMonth >= 3) newCSS = 'spring.css'; // Month is March or greater | |
if (currMonth >= 11) newCSS = 'winter.css'; // Month is June or greater | |
// Assign new style sheet name as the new href for "siteCSS" LINK tag | |
document.getElementById('siteCSS').href = newCSS; | |
</script> | |
</head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment