JS,注册时,需要过多少秒后才能点确定的JS控制按钮可用与不可用

出处:http://hi.baidu.com/yuanxiangyi/blog/item/961b3bd16411cb389a502758.html

<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />


</head>
<body>
<form name="bbrules">
<input type="submit" name="rulesubmit" style="height: 23px;" value="同 意" />
</form>


<script language="javascript">
<!--
//此段JS必须放在表单下面
var secs = 2;
var wait = secs * 1000;
document.bbrules.rulesubmit.value = "同 意(" + secs + ")";
document.bbrules.rulesubmit.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.bbrules.rulesubmit.value = "同 意";
 }
 else
 {
  printnr = (wait/1000) - num;
  document.bbrules.rulesubmit.value = "同 意(" + printnr + ")";
 }
}
function timer()
{
 document.bbrules.rulesubmit.disabled = false;
 document.bbrules.rulesubmit.value = "同 意";
}
-->
</script>

</body>
</html>

posted on 2009-08-10 17:35  Ss_Andy  阅读(1225)  评论(0编辑  收藏  举报