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');
    }
    });

    //}

    }

  • 相关阅读:
    container宽度
    NO.14 两个div并排,左边为绝对宽度,右边为相对宽度
    CSS3旋转图片效果收集
    背景图片问题
    CSS动画
    前端比较有用的网址
    JS如何判断IE和火狐与Chrome浏览器
    JAVA多线程面试题目
    JAVA多线程之Semaphore
    阿里多线程笔试题
  • 原文地址:https://www.cnblogs.com/lanliying/p/4828253.html
Copyright © 2011-2022 走看看