title: getElementById in a For loop
body: <p>I'm using a For loop to run through an array and return relevant strings. When I use getElementById, I only get the last string, but if I use document.write, everything comes out fine.</p>
  
  <pre><code>var names = ["John","Jamie","Jessica","Judy","Jeffery","Joy"];
  for (i=0,tot=names.length; i &lt; tot; i++) {
   document.getElementById("namelist").innerHTML = names[i];
  }
  </code></pre>
  
  <p>and the HTML is
      <code>&lt;p id="namelist"&gt;list of names go here&lt;/p&gt;</code></p>
  
  <p>What I get when I run that is "Joy". Is it not possible to use getElementById in this case? Is there some other way to get the returned list inside of one element?</p>
  
  <p>I've read through some of the other questions and answers on here, but none are exactly what I want</p>
  
  <p>Thanks!</p>