注册 登录 充值会员 退出
联系客服 毕业设计 java源码 PHP源码
充值

jQuery精确到毫秒的网页倒计时js代码

作者/代码整理:  (源码已亲测,不会安装的可以向QQ1915635791要安装视频教程) 发布日期:2022-08-19
jQuery精确到毫秒的网页倒计时js代码
jQuery精确到毫秒的倒计时代码是一款60秒倒计时网页特效js代码。


JS代码


<script type="text/javascript" src="jquery-1.8.3.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		var times = 60 * 100; // 60秒
		countTime = setInterval(function() {
			times = --times < 0 ? 0 : times;
			var ms = Math.floor(times / 100).toString();

			if(ms.length <= 1) {
				ms = "0" + ms;
			}
			var hm = Math.floor(times % 100).toString();
			if(hm.length <= 1) {
				hm = "0" + hm;
			}
			if(times == 0) {
				alert("游戏结束");
				clearInterval(countTime);
			}
			// 获取分钟、毫秒数
			$(".a").html(ms);
			$(".b").html(hm);
		}, 10);
	});
</script>

关注公众号,免费赠送安装视频教程、环境和学习视频,后面会不断更新。