Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai
I have 6 textbox for enter serial number in asp.net.i have to move next textbox automatically after 4 letters enter in each textbox.The below code is works, but if i change input type to asp TextBox it not work .
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JavaScript to automatically move from one field to another field</title>
<script type="text/javascript">
function movetoNext(current, nextFieldID) {
if (current.value.length >= current.maxLength) {
document.getElementById(nextFieldID).focus();
}
}
</script>
</head>
<body>
Enter your Text:
<input type="text" id="first" size="4" onkeyup="movetoNext(this, 'second')" maxlength="3" />
<input type="text" id="second" size="4" onkeyup="movetoNext(this, 'third')" maxlength="3" />
<input type="text" id="third" size="5" maxlength="4" />
</body>
</html>


onkeyup properties is not work.

Below code aslo not work

HTML
document.getElementById('txt1').onkeydown = function() {
  if (this.value.length == this.maxLength)
    document.getElementById('txt2').focus();
}


Not: i am use master page and i want to use asp textbox ,pls reply me asap.
pls reply with use master page also(i.e document.getElementById("Contenplacholder1_txtone"))

Regards
Aravind
Posted
Comments
kiritg 26-Feb-14 8:56am    
http://aspsolutionkirit.blogspot.com/2014/02/how-to-move-to-next-textbox-in-aspnet.html

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