function check(form){
let oldPassword= $("#inputOldPassword").val(),newPassword = $("#inputNewPassword").val(),confirmPass=$("#confirmNewPassword").val();
if(oldPassword=='') {
showMsg("输入的原密码为空");
return false;
}else if (oldPassword!=userPasswordOld) {
showMsg("输入的原密码错误");
return false;
}else if (newPassword=='' || confirmPass=='') {
showMsg("输入的新密码为空");
return false;
}else if (newPassword.indexOf(' ')>=0) {
//indexOf方法可返回某个指定的字符串值在字符串中首次出现的位置。
showMsg("新密码不能包含空格");
return false;
}else if (newPassword != confirmPass) {
showMsg("两次输入的密码不一致");
return false;
}else if(checkPass(newPassword)){
showMsg("请重新设置!新密码需至少6位最多12位");
return false;
}
showMsg("成功");
return true;
}
设置眼睛图标
https://www.iconfont.cn/search/index?searchType=icon&q=眼睛
function eyeseOpen(){
let imgeyes=document.getElementById('imgeyes');
imgeyes.src.indexOf('eyes-close')>=0 ? imgeyes.src='img/eyes-open.svg': imgeyes.src='img/eyes-close.svg';
let inputPass=document.getElementsByClassName('inputPwd');
for (var i = 0; i < inputPass.length; i++) {
inputPass[i].type=='text'?inputPass[i].type='password' : inputPass[i].type='text';
}
}