显示协议时的倒计时代码(倒计时时按钮为不可用属性)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
var times = 10;
function count() {
var btn = document.getElementById("btn");
if (times > 0) {
btn.value = "同意(倒计时" + times + ")";
times--;
}
else {
btn.value = "同意";
btn.disabled = false;
clearInterval(tid);
}
}
var tid = setInterval("count()", 1000);
</script>
</head>
<body onload="count()">
注册协议:
<br />
<input id="btn" type="button" value="同意" disabled="disabled" />
</body>
</html>