How to parse a variable in Javascript
<p>I'm trying to use this code:</p>

<pre><code>var field="myField";
vals[x]=document.myForm.field.value;
</code></pre>

<p>In the html code I have</p>

<pre><code>&lt;form name="myForm"&gt;
  &lt;input type='radio' name='myField' value='123' /&gt; 123
  &lt;input type='radio' name='myField' value='xyz' /&gt; xyz
&lt;/form&gt;
</code></pre>

<p>But this gives me the error:</p>

<pre><code>document.myForm.field is undefined
</code></pre>

<p>How can I get <code>field</code> to be treated as a variable rather than a field?</p>
