js控制按钮10秒后才能用

<script language="javascript">
function start()
{
     document.getElementById("Button1").disabled = true;
     document.getElementById("Button1").value = 10;
     window.setTimeout("tick()",1000);
    
}
function tick()
{
     var time = new Number(document.getElementById("Button1").value);
     if(time>0)
     {
         document.getElementById("Button1").value = time-1;
         window.setTimeout("tick()",1000);
     }
     else
     {
         document.getElementById("Button1").disabled = false;
         document.getElementById("Button1").value = "保存";
     }
}
</script>
<form >
<INPUT TYPE="button" NAME="Button1" id="Button1" size="5">
</form>

<script language=javascript>
start();
</script>

posted @ 2010-11-10 20:50  你妹的sb  阅读(759)  评论(0编辑  收藏  举报
百度一下