zoukankan      html  css  js  c++  java
  • 记录一个JQUERY模仿序列号输入

    <!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>
    <script language="javascript" src="js/jquery-1.4.1.min.js"></script>
    <script language="javascript">
     function autoFocus(objId){
        var id = "macAddr"+(objId+1);
        var next = document.getElementById(id);
        if(document.getElementById("macAddr"+objId).value.length>=4 && next!=undefined){
            //alert("asdf");
            next.focus();
        }
        }
    
        $(document).ready(function(){
            $(":input[id^='macAddr']").bind('keyup', handleAddr);
        });
    
        function handleAddr(){
           var current = this;
           var currvalue = current.value;
           var reg = /[^\A-Fa-f0-9]|_/ig;
           var index = parseInt(current.id.substring(7)) ;
           autoFocus(index);
        }
    </script>
    </head>
    
    <body>
    <input name="textfield" type="text" id="macAddr1" size="4" maxlength="4" /> 
    -
    <input name="textfield2" type="text" id="macAddr2" size="4" maxlength="4" />
    -
    <input name="textfield3" type="text" id="macAddr3" size="4" maxlength="4" />
    -
    <input name="textfield4" type="text" id="macAddr4" size="4" maxlength="4" />
    </body>
    </html>
  • 相关阅读:
    微信公众号验证域名
    go在mac上打其他平台包
    screen窗口化管理守护进程
    kettle字符串null转空串
    MAC M1安装kettle spoon
    删除git文件版本控制
    LNMP状态管理命令
    事务处理
    精通 JS正则表达式
    php日期转时间戳,指定日期转换成时间戳
  • 原文地址:https://www.cnblogs.com/superfeeling/p/2813894.html
Copyright © 2011-2022 走看看