十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
/*按钮禁用10秒*/
function disabledSubmitButton(submitButtonName){
$("#"+submitButtonName).attr({"disabled":"disabled"}); //控制按钮为禁用
var timeoutObj = setTimeout(function () {
$("#"+submitButtonName).removeAttr("disabled");//将按钮可用
/* 清除已设置的setTimeout对象 */
clearTimeout(timeoutObj)
}, 10000);
}
/*按钮禁用10秒,并显示倒计时*/
function disabledSubmitButton02(submitButtonName, submitButtonText){
$("#"+submitButtonName).attr({"disabled":"disabled"}); //控制按钮为禁用
var second = 10;
var intervalObj = setInterval(function () {
$("#"+submitButtonName).text(submitButtonText + "(" + second + ")");
if(second == 0){
$("#"+submitButtonName).text(submitButtonText);
$("#"+submitButtonName).removeAttr("disabled");//将按钮可用
/* 清除已设置的setInterval对象 */
clearInterval(intervalObj);
}
second--;
}, 1000 );
}