日期:2014-05-16  浏览次数:20330 次

js禁用button,js 将某个按钮禁用5秒钟
<FORM action=reg.asp?action=apply method=post>
<INPUT type=submit value="请认真查看<服务条款和声明>(10 秒后继续)" ></Form>

<SCRIPT language=javascript>
   var secs = 10;
   document.agree.agreeb.disabled=true;
   for(i=1;i<=secs;i++) {
       window.setTimeout("update(" + i + ")", i * 1000);
   }
 function update(num) {
   if(num == secs) {
       document.agree.agreeb.value ="同意并注册";
       document.agree.agreeb.disabled=false;
   }
   else {
       printnr = secs-num;
       document.agree.agreeb.value = "请认真查看<服务条款和声明> (" + printnr +" 秒后继续)";
   }
}
</SCRIPT>

?

?

###注意:使用js如何禁用button按钮:

? <input type="button" id="test" value="测试按钮" onclick="testButton()"/>

<script type="text/javascript">

?function testButton()

?{??????

?????? var aaa = document.getElementById('test');

???????aaa.disabled=true; //使用true或false,控制是否让按钮禁用

? }?

</script>

?