Cannot read property 'value' of undefined
<p>I have a simple form like this:</p>

<pre><code>&lt;form method="post" id="login"&gt;

Username: &lt;input type="text" value="" name="usr" /&gt;
Password: &lt;input type="password" value="" name="pw"/&gt;
&lt;input type="submit" id="log" name="log" value="Login" style="width:250px;"/&gt;&lt;br/&gt;

&lt;/form&gt;
</code></pre>

<p>But i keep getting cannot read property for my javascript with this line:</p>

<pre><code>var usr = login.usr.value;
var pw = login.pw.value;
</code></pre>

<p>What is the reason i get this error ?</p>
