<!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>
<title>逼真图片倒计时</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style type="text/css">
.time{width:200px;height:25px;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="time_number.jpg"></span>
<span><img id="hour_02" alt="" src="time_number.jpg"></span>
<span class="danwei">:</span>
<span><img id="minute_01" alt="" src="time_number.jpg"></span>
<span><img id="minute_02" alt="" src="time_number.jpg"></span>
<span class="danwei">:</span>
<span><img id="second_01" alt="" src="time_number.jpg"></span>
<span><img id="second_02" alt="" src="time_number.jpg"></span>
<br class="clear">
</div>
<script type="text/javascript">
var overa;
overa = new Date(2012, 02, 16, 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 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 (day <= 9) day = '0' + day;
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
document.getElementById('hour_01').style.marginTop = (hour.toString().substr(0,1)) * (-25) +'px';
document.getElementById('hour_02').style.marginTop = (hour.toString().substr(1,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>