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>
  • 相关阅读:
    迁移学习
    GAN
    PCA
    LSTM
    hdu 1754 I Hate It 线段树
    hdu 4292 Food 最大流
    hdu 2222 Keywords Search AC自动机
    hdu 3572 Task Schedule hdu 2883 kebab 最大流
    poj 1966 Cable TV Network 点连通度
    hdu 2236 匹配
  • 原文地址:https://www.cnblogs.com/superfeeling/p/2813894.html
Copyright © 2011-2022 走看看