方式一:禁用10秒,10秒钟后可用
/*按钮禁用10秒*/
function disabledSubmitButton(submitButtonName){
$("#"+submitButtonName).attr({"disabled":"disabled"}); //控制按钮为禁用
var timeoutObj = setTimeout(function () {
$("#"+submitButtonName).removeAttr("disabled");//将按钮可用
/* 清除已设置的setTimeout对象 */
clearTimeout(timeoutObj)
}, 10000);
}
方式二:禁用10秒,10秒钟后可用,且有倒计时提示
/*按钮禁用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 );
}
网页名称:js禁用按钮10秒(或者jquery)
网页地址:
http://cdweb.net/article/jsihhj.html