title: Javascript variable as html tag name
body: <p>Here is my code..</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;script&gt;
  function genbox()
  {
  var i;
  var myarray = new Array();
  myarray[0] = "name";
  myarray[1] = "dob";
  myarray[2] = "email";
  for (i=0;i&lt;myarray.length;i++)
  {
  document.write('&lt;input name="' + myarray[i] + '"/&gt;');
  }
  }
  &lt;/script&gt;
  &lt;body&gt;
  &lt;input type="button"  value="create" onclick="genbox();"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Old:I want the textbox name as the values of the array such as name, dob etc. but all i'm getting is 3 textboxes with the same name "myarray[i]". Please help me.</p>
  
  <p>Okay, Here we go, I'm pretty new to js. After clicking the button it creates 3 textboxes, but, the button disappears, What should I do to keep the button alive???   </p>