1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 安全密码输入框html 密码输入框.html

安全密码输入框html 密码输入框.html

时间:2019-11-12 23:27:20

相关推荐

安全密码输入框html 密码输入框.html

密码输入框

.inputDiv {

width: 240px;

height: 50px;

margin: 100px auto;

}

input {

display: block;

box-sizing: border-box;

width: 50px;

height: 50px;

border: 1px solid darkkhaki;

text-align: center;

line-height: 50px;

font-size: 30px;

color: #3a87ad;

float: left;

margin: 0 5px;

}

var txts = $(".inputDiv input");

for (var i = 0; i < txts.length; i++) {

var t = txts[i];

t.index = i;

//t.setAttribute("readonly", true);

t.onkeyup = function (e) {

var next = this.index + 1;

if (next < 0) {

next = 0

}

if (next > 3) {

next = 3

}

txts[next].focus();

if (e.keyCode === 8) {

txts[$(this).index() - 1 < 0 ? 0 : $(this).index() - 1].focus().val("");

}

};

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。