木子屋 Dnawo's BLOG

按钮倒计时

👤 dnawo 📅 2006-12-28 👁 4913 👍 0 💬 0 🔄 来源:本站原创
在会员注册时很多网站都有一份协议或条款提供给用户阅读,又为了避免部分用户不阅读而直接点击"我同意"按钮跳过,通常的方法便是在一段时间内使按钮失效,实现方法如下:

HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>同意条款</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <input type="submit" name="Submit" value="同意" />
</form>
<script language="javascript">
document.form1.Submit.disabled = true;
var speed = 1000; //速度
var wait = 10; //停留时间
function updateinfo(){
	if(wait == 0){
		document.form1.Submit.value = "我同意";
		document.form1.Submit.disabled = false;
	}
	else{
		document.form1.Submit.value = "阅读条款"+wait;
		wait--;
		window.setTimeout("updateinfo()",speed);
	}
}
updateinfo();
</script>
</body>
</html>

评论(0)

暂无评论。

验证码
评论需审核通过后显示
← 上一篇 “红楼钱庄”插件v2.1 For 7.1奖励用户和扩充金额错误修… 下一篇 → 实用javaScript技术总结(1):屏蔽类