密码验证

function validate() {
var pwd1 = document.getElementById("password").value;
var pwd2 = document.getElementById("absPassword").value;

if (pwd1 == pwd2 && pwd1!='' && pwd2!='') {
document.getElementById("passError").innerHTML = "<font color='green'>两次密码相同</font>";
}
else {
document.getElementById("passError").innerHTML = "<font color='red'>两次密码不相同</font>";
}
}
function password() {
var a = document.getElementById("btn").title;
if (a=='s') {
document.getElementById("password").type = "text";
document.getElementById("btn").title = "h";
} else if (a == 'h') {
document.getElementById("password").type = "password";
document.getElementById("btn").title = "s";
}
}
function password1() {
var a = document.getElementById("btn1").title;
if (a == 's') {
document.getElementById("absPassword").type = "text";
document.getElementById("btn1").title = "h";
} else if (a == 'h') {
document.getElementById("absPassword").type = "password";
document.getElementById("btn1").title = "s";
}
}

 

 

 

<li class="form-group">
<label for="exampleInputPassword1"><span class="error"></span><span id="leftText">*密码:</span></label>
<button id="btn" οnclick="password()" title="s">s</button><input type="password" class="form-control" ng-model="form.password" id="password" placeholder="至少三位数字">
</li>
<li class="form-group">
<label for="exampleInputFile"><span class="error"></span><span id="leftText">*确认密码:</span></label>
<button id="btn1" οnclick="password1()" title="s">s</button><input type="password" class="form-control" id="absPassword" ng-model="form.passwordCha" placeholder="Password" οnkeyup=" validate()">
<p id="passError"></p>
</li>

转载于:https://www.cnblogs.com/0280-hnn/p/7264466.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值