hi,try this
<script type="text/javascript">
function movetoNext(current, nextFieldID) {
if (document.getElementById(current).value.length >= document.getElementById(current).maxLength) {
if (document.getElementById(nextFieldID) != null) {
document.getElementById(nextFieldID).focus();
}
}
}
</script>