title: Adding new list elements to an unordered list with Javascript
body: <p>I am trying to add new elements to an unordered list with the following code:</p>
  
  <p>The HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Javascript&lt;/title&gt;
  &lt;link rel="stylesheet" href="jsPlay.css" type="text/css" /&gt;
  &lt;script src="jsPlay.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;ul id="numberList"&gt;&lt;/ul&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The Javascript:</p>
  
  <pre><code>window.onload = function()
  {
      //alert("Window is loaded");
  
      var numberList = document.getElementById("numberList");
  
  
      //for every number between 100 and 200      
      for(var i = 0; i &gt; 100 &amp;&amp; i &lt; 200; i++)
      {
          if ( i % 17 == 0 &amp;&amp; i % 2 == 0) //if number evenly divisible by 17 and 2
          {
                      //create new li element
              var newNumberListItem = document.createElement("li");
  
                      //create new text node
              var numberListValue = document.createTextNode(i);
  
                      //add text node to li element
              newNumberListItem.appendChild(numberListValue);
  
                      //add new list element built in previous steps to unordered list
                      //called numberList
              numberList.appendChild(newNumberListItem);
  
          }
      }
  }
  </code></pre>
  
  <p>When I run this in my browser, I just get nothing but white-space. I check in FireBug (on Firefox 15.0.1) to see if there are any errors, but there is nothing noticeable. I think I am not binding something together properly - it seems like such a basic problem but I can't seem to fgure out why the elements aren't being added to the unordered list.</p>
  
  <p>I'm sure the commenting in the Javascript code is sufficient, but feel free to ask me questions if it isn't.</p>
  
  <p>Many thanks for the help :).</p>