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>

  • 相关阅读:
    博客园随笔备份Java脚本
    vue 获取 referer
    EntityFramework的天坑
    清空stringbuilder
    相关的验证的正则表达式
    清空StringBuilder的三种方法及效率
    oracle中的字符串函数详解
    浅谈C# application.DoEvent作用
    C# 简单Tcp通信demo
    C#中http请求下载的常用方式demo
  • 原文地址:https://www.cnblogs.com/0280-hnn/p/7264466.html
Copyright © 2011-2022 走看看