JS倒计时 代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>2008北京奥运会开幕倒计时-51windows.Net</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<p>一个简单的倒计时代码</p>
<p>离2008北京奥运会开幕还有<span id="_lefttime" style="color:red;font-size:18pt;"></span></p>
<SCRIPT LANGUAGE="JavaScript">
function _fresh()
{
var endtime=new Date("August 8, 2011 20:00:00");
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);//2008-3-12改正,原来将60写成24了
__s=parseInt(leftsecond%60);
document.getElementById("_lefttime").innerHTML=__d+"天 "+__h+"小时"+__m+"分"+__s+"秒";
}
_fresh()
setInterval(_fresh,1000);
</SCRIPT>
</body>
</html>