jquery 60秒倒计时

<!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>

时间: 2024-11-05 16:24:11

jquery 60秒倒计时的相关文章

jquery 60秒倒计时(方法二)

<script type="text/javascript">var wait=60;document.getElementById("btn").disabled = false;function time(o) { if (wait == 0) { o.removeAttribute("disabled"); o.value="获取验证码"; wait = 60; } else { o.setAttribute

js jquery 按钮点击后 60秒之后才能点击 60秒倒计时

var wait = 60; function time(o) { if (wait == 0) { $(o).attr("disabled", false); $(o).val("获取验证码"); wait = 60; } else { $(o).attr("disabled", true); o.val(wait + "秒后重新发送"); wait--; setTimeout(function () {time(o);},

js实现60秒倒计时效果(使用了jQuery)

今天碰到要实现一个类似那种短信验证码60秒倒计时的需求,好久不写js,有点手生.把代码记录下,方便后续查阅. 这里我用了jQuey,毕竟写起来简洁点.下面直接看效果和代码. 一.效果 二.代码 (1)html <input type="button" id="btn" value="免费获取验证码" onclick="daojishi(10,this)" /> 注意:要引入JQuery (2)js <scri

验证码60秒倒计时

验证码60秒倒计时(jQuery), 代码如下: //验证码倒计时 var countdown = 60; var st; function settime(element) { if (countdown != 0) { st = setTimeout(function () { settime(element); }, 1000); } if (countdown == 0) { element.removeAttr("disabled"); element.val("获

yii框架实现注册页面短信验证60秒倒计时

先说下简单的,直接用jquery来实现短信验证60秒倒计时,然后在说明在yii框架下怎么实现的. <!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">

点击按钮出现60秒倒计时js代码

<!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-

淘宝60秒倒计时

<!DOCTYPE html> <html> <head> <title>60秒倒计时</title> <script type="text/javascript"> window.onload=function(){ var oBtn = document.getElementById('but'); var conut = 60; var timer = null; oBtn.onclick=function(

Jquery 插件防刷新 60秒倒计时

//先到官网(http://plugins.jQuery.com/cookie/)下载cookie插件,放到相应文件夹,代码如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>

jQuery实现发送短信验证码后60秒倒计时

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> var countdown=60; functi