/ Published in: JavaScript
Use this in the `` of your HTML files.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<link rel="stylesheet" type="text/css" media="screen, projection" href="screen.css" /> <script type="text/javascript"> <!-- var d = new Date(); var sunrise = 6; // 6 AM var sunset = 18; // 6 PM var currentHour = parseInt(d.getHours()); if(currentHour >= sunset || currentHour <= sunrise){ document.write('<link rel="stylesheet" href="dark.css" media="screen, projection" /' + '>'); } // --> </script>