var secs = 9;
var wait = secs * 1000;
/*其中licenseform为提交表单即<form name="licenseform">...</form>,
其中btnSubmit为按钮submit的name值即<input type="button" name="btnSubmit"/>*/
document.licenseform.btnSubmit.value = "我同意 [" + secs + "]";
document.licenseform.btnSubmit.disabled = true;
for(i = 1; i <= secs; i++){
window.setTimeout("Update(" + i + ")", i * 1000);
}
//
window.setTimeout("Timer()", wait);
function Update(num){
if(num != secs) {
printnr = (wait / 1000) - num;
document.licenseform.btnSubmit.value = "我同意 [" + printnr + "]";
}
}
function Timer(){
document.licenseform.btnSubmit.disabled = false;
document.licenseform.btnSubmit.value = " 我同意 ";
}
按钮提交倒计时实现
最新推荐文章于 2021-10-15 10:42:14 发布