title: How can I access an array declared in an HTML hidden input from a Javascript function?
body: <p>I have declared an array in a hidden input in my HTML form. Now I want to access that array in a Javascript function. For this, I have written the following code:</p>
  
  <pre><code>&lt;form name="form1"&gt;
    &lt;input type="hidden" name="sq[]" &gt;&lt;/input&gt;
    &lt;input type="hidden" name="a" &gt;&lt;/input&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And in the Javascript function:</p>
  
  <pre><code>function myfunction()
  {
    document.form1.a.value=i; // Here, I can access the variable 'a'
                              // (since a is not in the form of array)
    var i;
    for(i=0;i&lt;4;i++)
    {
      document.form1.sq[i].value=i; // Here, I am not able to access array named sq[].
    }
  }
  </code></pre>