阅读协议等待计时器
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>欢迎来到daomul的博客,欢迎再来,谢谢</title>
<script type="text/javascript">
var leftTime = 10;
var TimeID;
function scroll() {//alert(222);
var btn = document.getElementById("btnAgree");
//如果网页速度非常慢的话,可能定时器运行的时候控件还没有加载!
if (btn) {//alert(11);
if (leftTime <= 0) {
btn.value = "同意";
btn.disabled = "";
clearInterval(TimeID);
}
else {
btn.value = "请阅读协议,同意(还剩下"+leftTime+"秒)";
leftTime--;
}
}
}
TimeID=setInterval("scroll()", 1000);
</script>
</head>
<body>
<textarea cols="20" rows="2"></textarea>
<input type="button" value="同意" disabled="disabled"/>
</body>
</html>
案例5:
复制代码 代码如下: