诶,我来修改一下吧

发表于:2007-06-30来源:作者:点击数: 标签:
script ID=clientEventHandlersJS LANGUAGE= java script !-- function T1_onkeyup() { if(document.card.T1.value.length==4){ document.card.T2.focus(); } } function T2_onkeyup() { if(document.card.T2.value.length==4){ document.card.T3.focus(); }
<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--
function T1_onkeyup() {
  if(document.card.T1.value.length==4){
     document.card.T2.focus();
   }
}
function T2_onkeyup() {
  if(document.card.T2.value.length==4){
     document.card.T3.focus();
   }
}

function T3_onkeyup() {
  if(document.card.T3.value.length==4){
     document.card.T4.focus();
   }
}
//-->
</script>

在<body>...</body>之间加入如下代码:
<form method="POST" name="card" action>
输入字符:
<input type="text" name="T1" size="4" maxlength="4" LANGUAGE="javascript" onkeypress="return T1_onkeyup()">-

<input type="text" name="T2" size="4" maxlength="4" LANGUAGE="javascript" onkeypress="return T2_onkeyup()">-

<input type="text" name="T3" size="4" maxlength="4" LANGUAGE="javascript" onkeypress="return T3_onkeyup()">-

<input type="text" name="T4" size="4" maxlength="4">
</form> 

原文转自:http://www.ltesting.net