<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>倒计时</title>
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
function initt(){
var etime= new Date('2015/11/18 18:17:00');
var stime = new Date();
var time =etime.getTime() - stime.getTime();
var $day=Math.floor(time/1000/60/60/24);
var $hours=Math.floor(time/1000/60/60%24);
var $minutes=Math.floor(time/1000/60%60);
var $seconds=Math.floor(time/1000%60);
if($seconds=='0'&&$hours=='0'&&$minutes=='0'&&$day=='0'){
alert('时间到!!!');
clearInterval($ck);
}
$str="当前时间:";
$str+=$day+"天 ";
$str+=$hours+":";
$str+=$minutes+":";
$str+=$seconds+"";
$('.main').html($str);
}
$ck=setInterval("initt()",1000);
</script>
<style>
.main{width:300px;height:100px;background-color:#cfcfcf;margin:0 auto;margin-top:200px;line-height:100px;text-align:center;}
</style>
</head>
<body>
<div class="main">
</div>
</body>
</html>