<a id="sendCode"> 发送验证码 </a>
 
$(function () {
    $("#sendCode").click(function () {
        
        if ($(this).hasClass("disabled")) {
            
        } else {
            
            $.get("/sms/sendcode?phone=" + $("#phoneNum").val(), function (data) {
                if (data.code != 0) {
                    alert(data.msg);
                }
            });
            timeoutChangeStyle();
        }
    });
});
var num = 10;
function timeoutChangeStyle() {
    $("#sendCode").attr("class", "disabled");
    if (num == 0) {
        $("#sendCode").text("发送验证码");
        num = 5;
        $("#sendCode").attr("class", "");
    } else {
        var str = num + "s 后再次发送";
        $("#sendCode").text(str);
        setTimeout("timeoutChangeStyle()", 1000);
    }
    num--;
}