eightHundreds
11/5/2016 - 2:07 AM

两次密码不一致

两次密码不一致

 window.onload = function () {
     var form = document.getElementById('change-psw-form')
     var psw2 = document.getElementById('psw2')
     psw2.oninput = function () {
         this.setCustomValidity('')
     }
 }
 function checkForm(form)
 {
     var psw2 = document.getElementById('psw2')
     var p2value = form.psw2.value;
     var p1value = form.psw.value;
     if (p1value != p2value) {
         psw2.setCustomValidity('两次密码不一致')
         return false;
     } else {
         return true;
     }
 }