Advertisement
Guest User

Untitled

a guest
May 26th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <link rel="stylesheet" type="text/css" href="css/winter.css" id="siteCSS"/>
  2. <script type="text/javascript">
  3.  
  4. // Get current month
  5. var currDate=new Date();
  6. var currMonth = currDate.getDate();
  7.  
  8. // Month returned by getDate() is 0 to 11 so add 1
  9. currMonth = parseInt(currMonth) + 1;
  10.  
  11. // Based on month assign style sheet name
  12. var newCSS = "default.css";
  13. if (currMonth >= 1) newCSS = "winter.css"; // Month is January or greater
  14. if (currMonth >= 3) newCSS = 'spring.css'; // Month is March or greater
  15. if (currMonth >= 11) newCSS = 'winter.css'; // Month is June or greater
  16.  
  17. // Assign new style sheet name as the new href for "siteCSS" LINK tag
  18. document.getElementById('siteCSS').href = newCSS;
  19.  
  20. </script>
  21. </head>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement