Kristopher
Photographer
- Dec 25, 2010
- 803
- 68
So I have this JS script that's supposed to change the CSS based upon the time the client is at.
So basically I have this:
I've added it to the test page and so far its not loading up anything besides the HTML. Anyone have a idea?
So basically I have this:
Code:
<script>
function getStylesheet() {
var currentTime = new Date().getHours();
if (0 <= currentTime&¤tTime < 5) {
document.write("<link rel='stylesheet' href='stylenight.css' type='text/css'>");
}
if (5 <= currentTime&¤tTime < 18) {
document.write("<link rel='stylesheet' href='styleday.css' type='text/css'>");
}
if (18 <= currentTime&¤tTime < 24) {
document.write("<link rel='stylesheet' href='stylenight.css' type='text/css'>");
}
}
getStylesheet();
</script>
<noscript><link href="style.css" rel="stylesheet"></noscript>