addEvent(fm.elements[‘a1‘], ‘keyup‘, tabForWard); addEvent(fm.elements[‘a2‘], ‘keyup‘, tabForWard); addEvent(fm.elements[‘a3‘], ‘keyup‘, tabForWard); function tabForWard(evt){ var e = evt || window.event; if(this.value.length == this.maxLength){ for(var i=0; i<fm.elements.length; i++){ if(fm.elements[i] == this){ fm.elements[i+1].focus(); return; } } } }
原文:http://www.cnblogs.com/oceanden/p/3937840.html