HTML5中用validity实现两次密码不一致的提醒啊

img

var pwd=document.getElementById("pwd");
//获取密码

if(pwd.validity.valueMissing==true){
pwd.setCustomValidity("密码不能为空");
}
else if(pwd.validity.patternMismatch==true){
pwd.setCustomValidity("密码必须4-10个英文字母或数字");
}

else{
pwd.setCustomValidity("");

}

var quepas=document.getElementById("quepwd");//确认密码

if(!quepas.equals(pwd)){
quepas.setCustomValidity("两次输入的密码不一致");
}