JS手机号码自动换位

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    电话号码:
        <input id="w1" type="text" onkeyup="if(this.value.length==1)document.all('w2').focus();" runat="server"
            maxlength="1" />
        <input type="text" id="w2" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w3').focus();" style="width:20" />
        <input type="text" id="w3" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w4').focus();"  style="width:20" />
        <input type="text" id="w4" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w5').focus();"  style="width:20"/>
        <input type="text" id="w5" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w6').focus();"  style="width:20"/>
        <input type="text" id="w6" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w7').focus();"  style="width:20"/>
        <input type="text" id="w7" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w8').focus();"  style="width:20"/>
        <input type="text" id="w8" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w9').focus();"  style="width:20"/>
        <input type="text" id="w9" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w10').focus();"  style="width:20"/>
        <input type="text" id="w10" maxlength="1" runat="server" onkeyup="if(this.value.length==1)document.all('w11').focus();"  style="width:20"/>
        <input type="text" id="w11" maxlength="1" runat="server"  />
    </div>
    </form>
</body>
</html>

posted @ 2011-07-19 09:21  徐一贺  阅读(506)  评论(0编辑  收藏  举报