码迷,mamicode.com
首页 > Web开发 > 详细

jquery 60秒倒计时

时间:2015-10-14 17:43:45      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>30秒</title>
</head>
<body>

<div style="width:280px;margin:40px auto 0 auto;">
<form action="#" method="post" name="agree"> 
<input type="button" value="请认真查看<服务条款和声明> (5)" name="agreeb" id="agreeb">
 </form> 
</div>

<SCRIPT language=javascript>
<!--
// var secs = 5;
// document.agree.agreeb.disabled=true;
// for(i=1;i<=secs;i++) {
// window.setTimeout("update(" + i + ")", i * 1000);
// }
// function update(num) {
// if(num == secs) {
// document.agree.agreeb.value =" 我 同 意 ";
// document.agree.agreeb.disabled=false;
// }
// else {
// printnr = secs-num;
// document.agree.agreeb.value = "请认真查看<服务条款和声明> (" + printnr +")";
// }
// }

var secs = 5;
document.getElementById(‘agreeb‘).disabled=true;
for(i=1;i<=secs;i++) {
window.setTimeout("update(" + i + ")", i * 1000);
}
function update(num) {
if(num == secs) {
document.getElementById(‘agreeb‘).value =" 我 同 意 ";
document.getElementById(‘agreeb‘).disabled=false;
}
else {
printnr = secs-num;
document.getElementById(‘agreeb‘).value = "请认真查看<服务条款和声明> (" + printnr +")";
}
}
//-->
</SCRIPT>
</body>
</html>

jquery 60秒倒计时

标签:

原文地址:http://www.cnblogs.com/roves/p/4877833.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!