复制代码 代码如下:
<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 60*60;//60*60 //一个小时,按秒计算,自己调整!
function CountDown(){
if(maxtime>=0){
//minutes = Math.floor(maxtime/60);
seconds = Math.floor(maxtime%60);
//msg = "距离结束还有"+minutes+"分"+seconds+"秒";
msg = "距离结束还有"+seconds+"秒";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*60){
alert('注意,还有5分钟!');
}
--maxtime;
}else{
clearInterval(timer);
//alert("时间到,结束!");
maxtime=60*60;
timer = setInterval("CountDown()",1000);
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="color:red"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 5*60;//60*60 //一个小时,按秒计算,自己调整!
var timer;
function CountDown(){
if(maxtime>=0){
var minutes = Math.floor(maxtime/60);
var seconds = Math.floor(maxtime%60);
var msg = "距离刷新还有"+minutes+"分"+seconds+"秒";
$('#timer').html(msg);
//document.all["timer"].innerHTML=msg;
--maxtime;
}else{
clearInterval(timer);
//一下两个方法是倒计时结束后调用的方法
searchTaskList();
myajax();
//设置下一次的倒计时
maxtime=5*60;
timer = setInterval("CountDown()",1000);
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="display:inline;color:red"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 60*60;//60*60 //一个小时,按秒计算,自己调整!
function CountDown(){
if(maxtime>=0){
//minutes = Math.floor(maxtime/60);
seconds = Math.floor(maxtime%60);
//msg = "距离结束还有"+minutes+"分"+seconds+"秒";
msg = "距离结束还有"+seconds+"秒";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*60){
alert('注意,还有5分钟!');
}
--maxtime;
}else{
clearInterval(timer);
//alert("时间到,结束!");
maxtime=60*60;
timer = setInterval("CountDown()",1000);
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="color:red"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 5*60;//60*60 //一个小时,按秒计算,自己调整!
var timer;
function CountDown(){
if(maxtime>=0){
var minutes = Math.floor(maxtime/60);
var seconds = Math.floor(maxtime%60);
var msg = "距离刷新还有"+minutes+"分"+seconds+"秒";
$('#timer').html(msg);
//document.all["timer"].innerHTML=msg;
--maxtime;
}else{
clearInterval(timer);
//一下两个方法是倒计时结束后调用的方法
searchTaskList();
myajax();
//设置下一次的倒计时
maxtime=5*60;
timer = setInterval("CountDown()",1000);
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="display:inline;color:red"></div>
标签:
js,倒计时
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“js实现倒计时(距离结束还有)示例代码”评论...