title: Change background based on the time of day
body: <p>im trying to write a script to change my body background based on the whether its am or pm, I have the following, only its not working, can anybody see why? </p>
  
  <pre><code>&lt;!-- Change background --&gt;
  var currentTime = new Date().getHours();
  if (7 &lt;= currentTime &amp;&amp; currentTime &lt; 20) {
      if (document.body) {
          document.body.background = "images/backgrounds/day.jpg";
      }
  }
  else {
      if (document.body) {
          document.body.background = "images/backgrounds/night.jpg";
      }
  }
  &lt;!-- Change background --&gt;
  </code></pre>