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>

  • 相关阅读:
    MVC中的helper标签
    自适应网页设计(Responsive Web Design)
    网站设计的最简主义
    Windows Forms数据绑定技术
    [C#]写自己的类库
    C#数据库连接字符串
    CSS float属性
    CSS之UL
    NET教程:MVC4使用Bundling,CSS中图片路径问题
    ASP.net 中Get和Post的用法
  • 原文地址:https://www.cnblogs.com/0280-hnn/p/7264466.html
Copyright © 2011-2022 走看看