title: Having trouble with createElement and appendChild
body: <p>I have a reasonably simple idea that I would like to implement.</p>
  
  <p>I have an array of objects with two properties: "id" and "name" I would like to list these in a series of "p" tags that would be within a "div".</p>
  
  <p>So here is the HTML:</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="listView"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And here is the JavaScript in the  tag:</p>
  
  <pre><code>sessionStorage.eventid = 2;
  var playerList = [];
  playerList[0].id = 0;
  playerList[0].name = "Add New Player";
  playerList.push({
      id: 5,
      name: "Asako"
  });
  playerList.push({
      id: 6,
      name: "James"
  });
  playerList.push({
      id: 7,
      name: "Brian"
  });
  playerList.push({
      id: 8,
      name: "Helmut Spargle"
  });
  
  function listAll() {
      var element = document.getElementById("listView");
      var div;
      var node;
      for (var i = 0; i &lt; playerList.length; i++) {
          div = document.createElement("div");
          div.setAttribute("onClick", "javascript: formOver(" + playerList[i].id + ")");
          node = "&lt;p&gt;" + playerList[i].name + "&lt;br /&gt;\n" +
          "&lt;small&gt;&amp;nbsp&lt;/small&gt;\n" +
          "&lt;/p&gt;\n";
          div.appendChild(node);
          element.appendChild(div);
      }
  }
  window.onLoad = function(){
      listAll();
  }
  </code></pre>
  
  <p>This doesn't fill the  with anything. I have put this up on <a href="http://jsfiddle.net/MowgliB/8NQ5u/" rel="nofollow">JSFiddle</a> as well.</p>
  
  <p>Have I misunderstood how Array.push works? Or something to do with appendChile and createElement?</p>
  
  <p>Thanks in advance for your help.</p>