zoukankan      html  css  js  c++  java
  • 密码验证

    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>

  • 相关阅读:
    docker使用
    解决wps linux中文字体名字全是英文
    解决小程序云函数操作数据库回调不执行
    解决XP“不是有效Win32程序” 不是改Platform toolset
    [hdu1686] Oulipo【KMP】
    [poj 2104] K-th Number【主席树】
    bzoj2806 [Apio2012]dispatching【可并堆】
    bzoj1492 [NOI2007]货币兑换Cash【cdq分治】
    [coci2015-2016 coii] torrent【树形dp 二分】
    [coci2015-2016 coii] Palinilap【字符串 哈希】
  • 原文地址:https://www.cnblogs.com/0280-hnn/p/7264466.html
Copyright © 2011-2022 走看看