方式一:
<input value="同 意" type="submit" name="rulesubmit" /> <script> var secs = 9; var wait = secs * 1000; document.bbrules.rulesubmit.value = "同 意(" + secs + ")"; document.bbrules.rulesubmit.disabled = true; function update(num) { if(num == (wait/1000)) { document.bbrules.rulesubmit.value = "同 意";} else { var printnr = (wait / 1000) - num; document.bbrules.rulesubmit.value = "同 意(" + printnr + ")";} } function timer() { document.bbrules.rulesubmit.disabled = false; document.bbrules.rulesubmit.value = "同 意";} for(i = 1; i<= secs; i++) { window.setTimeout("update(" + i + ")",i * 1000); } window.setTimeout("timer()", wait); </script>
方式二:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <body> </body> var n = 10;//计数器 </script> |