Javascript: how to access property whose name is dynamic?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7028035/javascript-create-variable-from-its-name">Javascript create variable from its name</a>  </p>
</blockquote>



<p>The code below checks to see if the javascript object <strong>form_errors</strong> has the property whose name is specified by <strong>this.name</strong>, where <strong>this</strong> refers to a text input </p>

<pre><code>if (form_errors.hasOwnProperty(this.name)) {
  alert(form_errors.&lt;this.name&gt;;
}
</code></pre>

<p>How can I access the property without hard-coding the property name but leaving in the generalized form <strong>this.name</strong> ? Thanks.</p>
