title: how to use getElementById to get the table specified with id
body: <p>i want to use js to add one row in an exsiting table,however i got an error:document.getElementById() is null,here is my code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;use js to create one row&lt;/title&gt;
  &lt;/head&gt;
  &lt;body &gt;
  
  &lt;tr id="table"&gt;
      &lt;td&gt;row 1&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;script&gt;
      window.onload = function(){  
          var td = document.createElement("td");
          td.innerHTML = "add row";
          var tr = document.getElementById("table");
          tr.appendChild(rows); 
      }   
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>