//settime($("#getPhoneCode"),60); function settime($obj, time) { if (time == 0) { $obj.attr("disabled", false); $obj.css("background", "#f38401").css(... ...
//settime($("#getPhoneCode"),60); function settime($obj, time) { if (time == 0) { $obj.attr("disabled", false); $obj.css("background", "#f38401").css("cursor", "pointer"); $obj.text("獲取手機驗證碼"); return; } else { $obj.attr("disabled", true); $obj.css("background", "#ccc").css("cursor", "not-allowed"); $obj.text("重新發送(" + time + ")"); time--; } setTimeout(function () { settime($obj, time) }, 1000) }