Get HTML input form variable stored as an array as javascript variables
<p>How do I get the value of an HTML input form that is stored as an array into a javascript variable:</p>

<p>HTML of input field</p>

<pre><code>&lt;input type="hidden" name="subject[0]" 
id="contact_subject" value="test message" /&gt;
</code></pre>

<p>...</p>

<pre><code>&lt;input name="contact" value="Send" type="submit" 
onkeypress="return validateMessage(0); false" 
onclick="return validateMessage(0); false"/&gt;
</code></pre>

<p>My javascript attempt:</p>

<pre><code>function validateMessage(counter){
var subject = document.forms["Contact"]["subject["+counter+"]"].value;
</code></pre>

<p>and also tried:</p>

<pre><code>var subject = document.forms["Contact"]["subject"][counter].value; 
</code></pre>

<p>subject is null on both attempts.</p>
