Focus on textbox based on URL.
Posted
by Cameron
on Stack Overflow
See other posts from Stack Overflow
or by Cameron
Published on 2010-04-08T16:17:47Z
Indexed on
2010/04/08
16:33 UTC
Read the original article
Hit count: 275
JavaScript
I have two forms on one page and want to have the input boxes focused based on the URL.
So for example: domain.com/Default.aspx#login and domain.com/Default.aspx#register
and the javascript I have this:
window.document.getElementById('<%=txtUserName.ClientID %>').focus();
window.document.getElementById('<%=txtEmail.ClientID %>').focus();
it might be better if the urls are Default.aspx?action=login actually (not sure if this effects the way in which it would work)
© Stack Overflow or respective owner