最简单的实现倒计时
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>倒计时</title>
</head>
<body>
<div id="times"></div>
<script type="text/javascript">
function _fresh()
{
var endtime=new Date("2015-01-01");//这里设置预制时间
var nowtime = new Date();
var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
if(leftsecond<0){leftsecond=0;}
__d=parseInt(leftsecond/3600/24);
__h=parseInt((leftsecond/3600)%24);
__m=parseInt((leftsecond/60)%60);
__s=parseInt(leftsecond%60);
document.getElementById("times").innerHTML=__d+"天 "+__h+"小时"+__m+"分"+__s+"秒";
}
_fresh()
setInterval(_fresh,1000);
</script>
</body>
</html>