网页中15秒后重新发送验证码,多少秒后发送验证码

网页中15秒后重新发送验证码,多少秒后发送验证码

 

    //按钮禁用15s
    $("#captchaBtn").attr("disabled","disabled");
    var time=15;
    window.setTimeout("tick("+time+")",1000);
    function tick(time)
    {
        //var time = new Number(document.getElementById("Button1").value);
        if(time>0)
        {
            $("#captchaBtn").text((time--)+"秒后重新发送");
            window.setTimeout("tick("+time+")",1000);
        }
        else
        {
            document.getElementById("captchaBtn").disabled = false;
            $("#captchaBtn").text("获取验证码");
        }

    }

 

posted @ 2018-06-06 09:27  与f  阅读(545)  评论(0编辑  收藏  举报