zoukankan      html  css  js  c++  java
  • 获取验证码

    <div class="randcode">
    <label for="">验证码:</label> <input class="txt-area" type="text"
    name="RandCode" id="RandCode" /> <input id="randcode_btn"
    class="btn" type="button" value="获取验证码" onclick="_code();" />
    <span id="code-span"> <i id="code_error_icon"
    class="error_icon" style=" left:383px;top: 250px;display: none;"></i> <span
    name="code_error" class="bus_error"></span></span>
    </div>

    var yzm = '';
    function _code() {
    //if (check2()) {
    $('#randcode_btn').unbind('click');
    $('#randcode_btn').attr('disabled', 'disabled');
    $('#randcode_btn').val('120');

    var i = 120;
    var sto = function() {
    if (--i > 0) {
    $('#randcode_btn').val(i + '');
    setTimeout(sto, 1000);
    } else {
    $('#randcode_btn').val('获取验证码');
    $('#randcode_btn').removeAttr('disabled');//变亮
    $('#randcode_btn').bind('click', _code);//重复事件
    }
    }
    setTimeout(sto, 1000);
    var phone = $('#tel_phone').val();
    var CertType = $("input[name='document_type']:checked").val();
    $.ajax({
    url : '/sms',
    type : 'post',
    data : {
    phone : phone,
    certType : CertType
    },
    dataType : 'json',
    success : function(data) {
    var message = decodeURI(data.message);
    yzm = decodeURI(data.yzm);
    // console.debug(message);
    if (message)
    alert(message + '验证码:' + yzm);
    },
    error : function() {
    alert('error');
    }
    });

    //}

    }

  • 相关阅读:
    vue整合富文本编辑器
    node.js快速入门
    springboot启动项目加载配置文件中的常量
    hihocoder1712 字符串排序(思维)
    大数运算
    hihocoder1323 回文字符串(区间dp)
    hdu6026 Deleting Edges(Dijkstra+思路)
    poj3087 Shuffle'm Up(bfs)
    hdu6024 Building Shops(区间dp)
    poj1651 Multiplication Puzzle(区间dp)
  • 原文地址:https://www.cnblogs.com/lanliying/p/4828253.html
Copyright © 2011-2022 走看看