Focus on textbox based on URL
<p>I have two forms on one page and want to have the input boxes focused based on the URL.</p>

<p>So for example: domain.com/Default.aspx#login and domain.com/Default.aspx#register</p>

<p>and the javascript I have this:</p>

<pre><code>        if (window.location.href = '?action=login')
        {
            window.document.getElementById('&lt;%=txtUserName.ClientID %&gt;').focus();
        }
        else if (window.location.href = '?action=register')
        {
            window.document.getElementById('&lt;%=txtRegEmail.ClientID %&gt;').focus();
        }
</code></pre>

<p><strong>EDITED</strong></p>
