首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

仿照填写序列号

2012-11-25 
模仿填写序列号function autoFocus(objId){var id macAddr+(objId+1)var next document.getElement

模仿填写序列号

 function autoFocus(objId){        var id = "macAddr"+(objId+1);        var next = document.getElementById(id);        if(document.getElementById("macAddr"+objId).value.length==2 && next!=undefined){            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;           if(reg.test(currvalue)){               alert('invalid');           }           else{             var index = parseInt(current.id.substring(7)) ;             autoFocus(index);           }    }

热点排行