运行代码 缩小
汉王
HTML代码
复制 格式化 注释 注释 清空
放大
AخA
 
1
<title>在规定时间内可用的按钮</title>
2
<form action="/" method="post" name="agree">
3
<input type="submit" value="请认真阅读服务条款和声明 (15)" name="agreeb">
4
</form>
5
<SCRIPT language=javascript>
6
<!--
7
var secs = 15;
8
document.agree.agreeb.disabled=true;
9
for(i=1;i<=secs;i++) {
10
 window.setTimeout("update(" + i + ")", i * 1000);
11
}
12
function update(num) {
13
 if(num == secs) {
14
 document.agree.agreeb.value =" 我同意 ";
15
 document.agree.agreeb.disabled=false;
16
 }
17
else {
18
 printnr = secs-num;
19
 document.agree.agreeb.value = "请认真阅读服务条款和声明 (" + printnr +")";
20
 }
21
}
22
//-->
23
</SCRIPT>
CSS代码
复制 格式化 注释 注释 颜色 清空
放大
CSS代码...
x
 
1
JS代码
复制 格式化 注释 注释 清空
放大
JS代码...
xxxxxxxxxx
1
 
1
名称
在规定时间内倒计时激活按钮
分类
网站常用
描述
让按钮在规定时间内生效可用,比如注册时候,按钮会在规定时间内倒计时,留足时间让用户认真阅读服务条款,当时间结束,按钮由灰色变为正常可用状态,这时候你才可以点击哦。
收藏