Click here to Skip to main content
15,891,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,
I have login form for authenticate user, I am using script to focus to password textbox when use press key on username textbox.

C#
function Focus(e) {
           
            alert(e.keyCode);}
<asp:TextBox ID="txtUsername" runat="server" TabIndex="0" onkeypress="return Focus(window.event);"></asp:TextBox>


Alert is working all keycode but when I press spacial key like tab, Enter,Backspace etc then it is not working.

I need to get the keycode of Tab key of keyboard so I am able to focus on password textbox when user press tab key on username textbox.

Thank you very much in advance!
Posted
Comments
ashok rathod 16-Jul-14 7:13am    
e.keyCode = 9 i think for tab

Further to Solution 1, you might find the responses to this post more helpful event fired when backspace is pressed in a textbox[^]
 
Share this answer
 
in keypress event tab and backspace gives no value .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900