title: Javascript function not getting a value from an input box and loop through an array
body: <p>im trying to gather an amount from a input box and then tick a certain amount of boxes which is an array.</p>
  
  <p>this is what i got so far and it doesnt work :S</p>
  
  <pre><code>function checkAmount(ting)  {  
  var boxes = document.getElementsByTagName("input");  
  for (var i = 0; i &lt; ting.value; i++)   {  
      if (boxes[i].name == "vote[]")   {  
          boxes[i].checked = true;  
      }  
  }  
  }
  </code></pre>
  
  <p>And im calling it with this:</p>
  
  <pre><code>uncheckAll(); 
  checkAmount(document.getElementsByName(\'ammount\'));
  </code></pre>