JavaScript 逼真图片倒计时实现代码 js时间图片倒计时

JavaScript 逼真图片倒计时实现代码 js时间图片倒计时JavaScript逼真图片倒计时实现代码js时间图片倒计时效果图:逼真图片倒计时距离发射升空还有:::

大家好,欢迎来到IT知识分享网。

JavaScript 逼真图片倒计时实现代码   js时间图片倒计时

效果图:

JavaScript 逼真图片倒计时实现代码 js时间图片倒计时

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<head> 
<title>逼真图片倒计时</title> 
<style type="text/css"> 
.time{width:200px;height:25px;border:1px red solid;overflow:hidden;} 
.time span{float:left;line-height:25px;height:25px;overflow:hidden;} 
.time span.danwei{padding:0 1px;} 
.clear{height:0;clear:both;overflow:hidden;} 
</style> 
</head> 
<body> 
距离发射升空还有: 
<div class="time" id="time1"> 
<span><img id="hour_01" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<span><img id="hour_02" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<span><img id="hour_03" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<span class="danwei">:</span> 
<span><img id="minute_01" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<span><img id="minute_02" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<span class="danwei">:</span> 
<span><img id="second_01" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<span><img id="second_02" alt="" src="http://files.jb51.net/upload/201009/20100917154719975.jpg"></span> 
<br class="clear"> 
</div> 
<script type="text/javascript"> 
var overa; 
overa = new Date(2017, 01, 01, 00, 00);///第数日时间当时间超过999小时 
var localNow = new Date(); 
function clock1(){ 
var local = new Date(); 
var intDiff = overa.getTime() - local.getTime(); 
if(intDiff <= 0){document.getElementById('time1').innerHTML = "活动已结束!";//显示活动结束 
return false;} 
var day = Math.floor(intDiff / (1000 * 60 * 60 * 24)); 
var hour = Math.floor(intDiff / (1000 * 60 * 60)) - (day * 24); 
var hour2 = Math.floor(intDiff / (1000 * 60 * 60)); 
var minute = Math.floor(intDiff / (1000 * 60)) - (day * 24 * 60) - (hour * 60); 
var second = Math.floor(intDiff / 1000) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60); 
if (hour2 <= 99) hour2 = '0' + hour2; 
if (day <= 9) day = '0' + day; 
if (hour2 <= 9) hour2 = '0' + hour2; 
if (minute <= 9) minute = '0' + minute; 
if (second <= 9) second = '0' + second; 
document.getElementById('hour_01').style.marginTop = (hour2.toString().substr(0,1)) * (-25) +'px'; 
document.getElementById('hour_02').style.marginTop = (hour2.toString().substr(1,1)) * (-25) +'px'; 
document.getElementById('hour_03').style.marginTop = (hour2.toString().substr(2,1)) * (-25) +'px'; 
document.getElementById('minute_01').style.marginTop = (minute.toString().substr(0,1)) * (-25) +'px'; 
document.getElementById('minute_02').style.marginTop = (minute.toString().substr(1,1)) * (-25) +'px'; 
document.getElementById('second_01').style.marginTop = (second.toString().substr(0,1)) * (-25) +'px'; 
document.getElementById('second_02').style.marginTop = (second.toString().substr(1,1)) * (-25) +'px'; 
setTimeout("clock1()", 1000); 
} 
clock1(); 
</script> 
</body> 
</html>



</body>
</html>

 

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/27669.html

(0)
上一篇 2023-09-21 12:15
下一篇 2023-09-21 13:45

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信