JScript 页面倒计时

 <script type="text/javascript" language="javascript">
           
var secs = 10;
           
var wait = secs * 1000;
           
var agreetext="ok";
            document.form1.Button1.value
= agreetext+"(" + secs + ") ";
            document.form1.Button1.disabled
= true;
           
for(i = 1; i <= secs; i++) {
             window.setTimeout(
"update(" + i + ")", i * 1000);}window.setTimeout("timer()", wait);
           
function update(num, value) {
            
if(num == (wait/1000)) {
             document.form1.Button1.value = agreetext;
             }
else {
             printnr
= (wait / 1000)num;
             document.form1.Button1.value
= agreetext+"(" + printnr + ") ";
             }
            }
           
function timer() {
             document.form1.Button1.disabled
= false;
             document.form1.Button1.value
= agreetext;
            }
     
</script>