JS-Jquery 同步校验两次密码是否相同

模版简易代码


	<li>
	<input id="password" name="password" placeholder="请输入密码"  onfocus='passwd()'  type="password" class="free-input input-w-200 pass"  maxlength="32" />
	</li>
	<li>
	<input id="password1" name="password1" type="password"  class="free-input input-w-200 pass"  onkeyup='validate()' placeholder="请再次输入密码" value="" />
	<br>
	<span id="tishi"></span>
	</li>



js代码:


function validate() {
    var pwd1 = document.getElementById("password").value;
    var pwd2 = document.getElementById("password1").value;
    if(pwd1 == pwd2) {
        document.getElementById("tishi").innerHTML="<font color='gray'>输入正确</font>";
/*         $("#tishi").hide(1500); */
        document.getElementById("dosubmit").disabled = false;
    }
    else {
      document.getElementById("tishi").innerHTML="<font color='red'>两次密码不相同</font>";
      document.getElementById("dosubmit").disabled = true;
    }
}



阅读更多
换一批

没有更多推荐了,返回首页