title: using javascript to loop through drop down html array
body: <p>I'm trying to populate a drop down menu with a javascript array.  I can get individual elements to show up but not the entire array.  I'm sure this question has been asked before, but can't find any references.  Any help would be appreciated.</p>
  
  <pre><code>var sex=["male","female", "unknown"];
  
  for (i=0;i&lt;sex.length;i++){
  var opt = document.createElement("option");
  document.getElementById("m").innerHTML=sex[i];
  }
  </code></pre>
  
  <p>The html is:</p>
  
  <pre><code>    &lt;form name = "demo"&gt;
      &lt;table id = "demo"&gt;
      &lt;th&gt;Demographics&lt;/th&gt;
      &lt;tr&gt;&lt;td&gt;Sex&lt;/td&gt;&lt;td&gt;&lt;select&gt;&lt;option id="m"&gt;&lt;/option&gt;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
      &lt;/form&gt;
  </code></pre>