<p>I have a form element that I want to address via javascript, but it doesn't like the syntax.</p>

<pre><code>&lt;form name="mycache"&gt;
  &lt;input type="hidden" name="cache[m][2]"&gt;
  &lt;!-- ... --&gt;
&lt;/form&gt;
</code></pre>

<p>I want to be able to say:</p>

<pre><code>document.mycache.cache[m][2]
</code></pre>

<p>but obviously I need to indicate that <code>cache[m][2]</code> is the whole name, and not an array reference to <code>cache</code>.  Can it be done?</p>

UPDATE: Actually, I was wrong, you can use [ or ] characters as part of a form elements id and/or name attribute.
Here's some code that proves it:
```
```
<html>
<body>

<form id="form1">

<input type='test' id='field[m][2]' name='field[m][2]' value='Chris'/>

<input type='button' value='Test' onclick='showtest();'/>

<script type="text/javascript">
function showtest() {
    var value = document.getElementById("field[m][2]").value;
    alert(value);
}
</script>

</form>

</body>
</html>
```
```
Update: You can also use the following to get the value from the form element:
```
```
var value = document.forms.form1["field[m][2]"].value;
```
```