- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>无标题文档</title>
- </head>
- <script>
- function keyJump1(obj){
- if(obj.length==4) {
- document.all.temp1.focus();
- }
- }
- function keyJump2(obj){
- if(obj.length==6)
- {
- document.all.temp2.focus();
- }
- }
- function keyJump3(obj){
- if(obj.length==8) document.all.temp3.focus();
- }
- function keyJumpTemp(obj){
- obj.focus();
- }
- </script>
- <body>
- <table border="0">
- <tr>
- <td><input name="personNumber1" type="text" class="textbox" style=" width:030; height:20 " onfocus="this.select()" onkeyup='keyJump1(this.value)' maxlength="4"></td>
- <td id="temp1" width="005" onkeyup="keyJumpTemp(document.all.personNumber2)">-</td>
- <td ><input name="personNumber2" type="text" class="textbox" style=" width:040; height:20" onfocus="this.select()" onkeyup='keyJump2(this.value)' maxlength="6"></td>
- <td id="temp2" width="005" onkeyup="keyJumpTemp(document.all.personNumber3)">-</td>
- <td ><input name="personNumber3" type="text" class="textbox" style=" width:055; height:20" onfocus="this.select()" onkeyup='keyJump3(this.value)' maxlength="8"></td>
- <td id="temp3" width="005" onkeyup="keyJumpTemp(document.all.personNumber4)">-</td>
- <td ><input name="personNumber4" type="text" class="textbox" style=" width:010; height:20" onfocus="this.select()" onkeyup='' maxlength="1"></td>
- </tr>
- </table>
- </body>
- </html>
转载于:https://blog.51cto.com/167584/38055