最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JavaScript實(shí)現(xiàn)PC端四格密碼輸入框功能

 更新時(shí)間:2020年02月19日 07:24:19   作者:噓,此處屬於婷  
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)PC端四格密碼輸入框功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了JavaScript實(shí)現(xiàn)PC端四格密碼輸入框的具體代碼,供大家參考,具體內(nèi)容如下

html代碼如下

比較簡潔的一個(gè)demo

<!DOCTYPE html>
<html>
 <head>
 <meta charset="UTF-8">
 <title>四個(gè)密碼輸入框</title>
 <script type="text/javascript" src="jquery.min.js" ></script>
 </head>
 <style type="text/css">
 input{
 width:40px;
 height:40px;
 text-align: center;
 font-size:22px;
 }
 </style>
 <body>
 支付密碼
 <input type="password" name="pwd1" maxlength="1"/>
 <input type="password" name="pwd2" maxlength="1"/>
 <input type="password" name="pwd3" maxlength="1"/>
 <input type="password" name="pwd4" maxlength="1"/>
 </body>
 <script>
 //必須引入jquery才可以用
 //1:當(dāng)輸入框1輸入1個(gè)字符后,自動(dòng)切換光標(biāo)到輸入框2
 $(document).ready(function(){
 $("[name='pwd1']").bind("input",function(){
 if($(this).val().length==1){
 $("[name='pwd2']").focus();
 }
 })
 $("[name='pwd2']").bind("input",function(){
 if($(this).val().length==1){
 $("[name='pwd3']").focus();
 }else if($(this).val().length==0){
 $("[name='pwd1']").focus();
 }
 })
 $("[name='pwd3']").bind("input",function(){
 if($(this).val().length==1){
 $("[name='pwd4']").focus();
 }else if($(this).val().length==0){
 $("[name='pwd2']").focus();
 }
 })
 $("[name='pwd4']").bind("input",function(){
 if($(this).val().length==0){
 $("[name='pwd3']").focus();
 }
 
 })
 })
 </script>
</html>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

龙井市| 高台县| 日喀则市| 瑞丽市| 阜新市| 密云县| 页游| 府谷县| 东港市| 香河县| 虹口区| 呼图壁县| 会泽县| 河南省| 大宁县| 都兰县| 登封市| 凉城县| 渝北区| 吉水县| 尼木县| 根河市| 登封市| 道真| 桃源县| 临沧市| 文水县| 桂东县| 镇原县| 巢湖市| 镇平县| 陇川县| 平乡县| 克东县| 嘉禾县| 莫力| 新闻| 阳城县| 大城县| 新营市| 岳普湖县|