码迷,mamicode.com
首页 > 其他好文 > 详细

密码验证

时间:2017-07-31 18:49:06      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:orm   hold   确认密码   btn   cti   element   验证   amp   sse   

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" onclick="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" onclick="password1()" title="s">s</button><input type="password" class="form-control" id="absPassword" ng-model="form.passwordCha" placeholder="Password" onkeyup=" validate()">
<p id="passError"></p>
</li>

密码验证

标签:orm   hold   确认密码   btn   cti   element   验证   amp   sse   

原文地址:http://www.cnblogs.com/0280-hnn/p/7264466.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!