zoukankan      html  css  js  c++  java
  • js自定义验证码

    分享一个js自定义的验证码
    window.onload = function () {
        var code;
        $('.changePassword').click(function () {
            if ($('#CheckText').val().toUpperCase()!== code) {
                alert("验证码输入错误!");
                return;
            }
            $('#ForgetPassword').submit();
        });
        if ($('#errorInfo').val() !== null && $('#errorInfo').val() !== "")
            alert($('#errorInfo').val());
     
    // if ($('#username').val() !== null && $('#username').val() !== "")
    // alert('用户名:' + $('#username').val() + ' ' + '密码:' + $('#userpassword').val());
        createCode();
        /*验证*/
        function createCode() {
            code = "";
            var codeLength = 5; //验证码的长度
            var selectChar = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
     
            for (var i = 0; i < codeLength; i++) {
                var charIndex = Math.floor(Math.random() * 32);
                code += selectChar[charIndex];
            }
            if (code.length != codeLength) {
                createCode();
            }
            $('#CheckPic').text(code);
        }
        $('#CheckRefresh').click(function () {
            createCode();
        });
    }
  • 相关阅读:
    聊聊oracle rowid与索引结构
    去除文本中的空行
    表与表空间
    文件导入到数据库——复杂版
    文件导入到数据库
    vmware workstation 12+oracle linux 5.10+oracle 11g 搭建rac
    oracle判断是否实施了rac
    面向对象-小练习
    面向对象-面向对象的可拓展性
    面向对象-一切皆对象
  • 原文地址:https://www.cnblogs.com/minesnil-forfaith/p/3615503.html
Copyright © 2011-2022 走看看