diff --git a/public/themes/simpleboot3/friendship/friend_list.html b/public/themes/simpleboot3/friendship/friend_list.html index 5fa67c8..cfa07d3 100644 --- a/public/themes/simpleboot3/friendship/friend_list.html +++ b/public/themes/simpleboot3/friendship/friend_list.html @@ -244,22 +244,22 @@ <p class="pleaseenterword">输入支付密码</p> <ul class="enterpassword"> <li> - <input type="text"> + <input type="text" class="entercode"> </li> <li> - <input type="text"> + <input type="text" class="entercode"> </li> <li> - <input type="text"> + <input type="text" class="entercode"> </li> <li> - <input type="text"> + <input type="text" class="entercode"> </li> <li> - <input type="text"> + <input type="text" class="entercode"> </li> <li> - <input type="text"> + <input type="text" class="entercode"> </li> </ul> </div> @@ -357,5 +357,50 @@ } }) + + //输入的密码自动输入到下一个 + onload = function(){ + var arr=[]; + var str="" + var txts = wrap.getElementsByClassName("entercode"); + console.log(txts) + for(var i = 0; i<txts.length;i++){ + var t = txts[i]; + t.index = i; + if(t.index>0){ + t.setAttribute("readonly", true); + } + t.onkeyup=function(){ + + var regular = /\s+/g; + if(regular.test(this.value)){ + $(this).focus(); + }else if($(this).val()==""){ + $(this).focus(); + }else{ + console.log($(this).val()); + arr.push($(this).val()); + + + + var next = this.index + 1; + if(next > txts.length - 1) return; + txts[next].removeAttribute("readonly"); + txts[next].focus(); + } + } + + if(t.index==5){ + t.onkeyup=function(){ + arr.push($(this).val()) + console.log(arr); + var str=arr[0]+arr[1]+arr[2]+arr[3]+arr[4]+arr[5]; + console.log(str) + } + } + + } + txts[0].removeAttribute("readonly"); + } </script> </html>