js 注冊時,控制同意按鈕時間

<div style="text-align:center;line-height:36px;">
                      
<input name="agree" disabled="disabled" type="submit" id="agree" value="我同意" class="sbutton" />
                    
                        
<script type="text/javascript">
                        
var secs = 5;
                        
var wait = secs * 1000;
                        document.getElementById(
"agree").value = "同 意(" + secs + ")";
                        document.getElementById(
"agree").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.getElementById("agree").value = "同 意";
                                }
 else {
                                        printnr 
= (wait / 1000- num;
                                        document.getElementById(
"agree").value = "同 意(" + printnr + ")";
                                }

                        }
                        
function timer() {
                                document.getElementById(
"agree").disabled = false;
                                document.getElementById(
"agree").value = "同 意";
                        }

                        
</script>
                </div>
posted @ 2008-02-18 10:05  Nina  阅读(347)  评论(0编辑  收藏  举报