Adding names to an array and outputting them to a table
<p>I'm having some trouble getting my code to work. This is what I have so far.</p>

<pre><code>function outputNamesAndTotal() {
  var name;
  var outputTable;
  var inputForm;
  var nameArray;
  var outputDiv;

  outputDiv = document.getElementById("outputDiv");
  inputForm = document.getElementById("inputForm");
  outputTable = document.getElementById("outputTable");
  name = inputForm.name.value;
  nameArray = [];

  nameArray.push(name);


  for (var i = 0; i &gt; nameArray.length; i++) {

    outputTable.innerHTML += "&lt;tr&gt;" + nameArray[i] + "&lt;/tr&gt;";

  }    

  inputForm.name.focus();
  inputForm.name.select();


  return false;

}
</code></pre>

<p>When I add the loop it breaks the code completely, but I can't figure out why.</p>

<p>What I'm trying to do is use an HTML form to get a name from the user. Once the user enters the name, the program adds the name to the array, and outputs each array entry to a row in a table.</p>

<p>It's pretty basic, but it's still giving me all kinds of trouble! </p>
