title: Cannot read property 'getContext' of null, using canvas
body: <p>I get the error <code>Uncaught TypeError: Cannot read property 'getContext' of null</code> and the important parts in files are... I am wondering since game.js is in a directory below, it cannot find canvas? What should I do?</p>
  
  <p>./index.html:</p>
  
  <pre><code>&lt;canvas id="canvas" width="640" height="480"&gt;&lt;/canvas&gt;
  </code></pre>
  
  <p>./javascript/game.js:</p>
  
  <pre><code>var Grid = function(width, height) {
          ...
          this.draw = function() {
          var canvas = document.getElementById("canvas");
          if(canvas.getContext) {
              var context = canvas.getContext("2d");
              for(var i = 0; i &lt; width; i++) {
                  for(var j = 0; j &lt; height; j++) {
                      if(isLive(i, j)) {
                          context.fillStyle = "lightblue";
                      }
                      else {
                          context.fillStyle = "yellowgreen";
                      }
                      context.fillRect(i*15, j*15, 14, 14);
                  }
              }
          }
      }
  }
  </code></pre>