如何实现js优惠券倒计时 10
倒计时不获取本地时间,在倒计时结束后载入一张图片遮住这个div。我不会js,求大神帮忙,谢谢!...
倒计时不获取本地时间,在倒计时结束后载入一张图片遮住这个div。我不会js,求大神帮忙,谢谢!
展开
展开全部
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jquery版的网页倒计时效果</title>
<style type="text/css">
</style>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
var intDiff = parseInt(86400); //倒计时总秒数量(1天=24*60*60=86400)
function timer(intDiff) {
window.setInterval(function() {
var day = 0,
hour = 0,
minute = 0,
second = 0; //时间默认值
if(intDiff > 0) {
day = Math.floor(intDiff / (60 * 60 * 24));
hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if(minute <= 9) minute = '0' + minute;
if(second <= 9) second = '0' + second;
$('#day_show').html(day + "天");
$('#hour_show').html('<s id="h"></s>' + hour + '时');
$('#minute_show').html('<s></s>' + minute + '分');
$('#second_show').html('<s></s>' + second + '秒');
intDiff--;
}, 1000);
}
$(function() {
timer(intDiff);
});
</script>
</head>
<body>
<div class="time-item">
<span id="day_show">0天</span>
<span id="hour_show">0时</span>
<span id="minute_show">0分</span>
<span id="second_show">0秒</span>
</div>
</body>
</html>
form
http://www.jq22.com/download/pd-3d2e942a-2a02-11e4-ac58-000c29b03321.zip
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<!DOCTYPE HTML>
<html>
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script>
var sum = 5; // 倒计时5秒,这个从后台服务器获取
setTimeout(function(){
zhegai.style.display = "block";
},sum*1000);
</script>
</head>
<body>
<div id="result">this is index page!</div>
<div id="zhegai" style="display:none;position: fixed; left: 0px; top: 0px; z-index: 50; background-color: rgb(0, 0, 0); opacity: 0.5; width: 100%; height: 100%; background-position: initial initial; background-repeat: initial initial;"></div>
</body>
</html>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询