title: Assign value for multiple input boxes using javascript?
body: <p>Hi I have a problem in assign single values to multiple input boxes. i am trying many ways but it assign only 1 text box. How can I assign multiple text boxes.</p>
  
  <p>Note: I have the same ID for all input boxes.</p>
  
  <p>My code is given below</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function getInputs()
  {
    var inputs = document.getElementsByTagName('input');
    var ids = new Array();
    for(var i = 0; i &lt; inputs.length; i++)
    {
      if(inputs[i].getAttribute('id').toLowerCase()== 'myid')
      {       
         document.getElementsById('myid').value="1";
      }
    }   
  }    
  window.onload = getInputs;
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form&gt;
    &lt;input type="text"  id="myid"&gt;&lt;br&gt;
    &lt;input type="text"  id="myid"&gt;&lt;br&gt;
    &lt;input type="text"  id="myid"&gt;&lt;br&gt;
    &lt;input type="text"  id="myid"&gt;&lt;br&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can anyone help?</p>