服务器时间倒计时

//格式化输出服务器时间
function getSeverTime(){
        
var xmlHttp = false;
//获取服务器时间
try {
xmlHttp 
= new ActiveXObject("Msxml2.XMLHTTP");
}
 catch (e) {
try {
    xmlHttp 
= new ActiveXObject("Microsoft.XMLHTTP");
}
 catch (e2) {
    xmlHttp 
= false;
}

}


if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp 
= new XMLHttpRequest();
}


xmlHttp.open(
"GET""null.txt"false);
xmlHttp.setRequestHeader(
"Range""bytes=-1");
xmlHttp.send(
null);

severtime
=new Date(xmlHttp.getResponseHeader("Date"));

//获取服务器日期
var year=severtime.getFullYear();
var month=severtime.getMonth()+1;
var date=severtime.getDate();
//获取服务器时间
var hour=severtime.getHours();
var minu=severtime.getMinutes();
var seco=severtime.getSeconds();
//获取客户端时间
localtime=new Date("8/8/2008 20:0:0");
//取得时间差
var jtime=Math.floor(localtime.getTime()-severtime.getTime());
var jdate=Math.floor(jtime/(24*60*60*1000));
var jhour=Math.floor(jtime%(24*60*60*1000)/(60*60*1000));
var jminu=Math.floor(jtime%(24*60*60*1000)%(60*60*1000)/(60*1000));
var jsecond=Math.floor(jtime%(24*60*60*1000)%(60*60*1000)%(60*1000)/1000);

seco
++;
if(seco==60){
minu
+=1;
seco
=0;
}

if(minu==60){
   hour
+=1;
   minu
=0;
}

if(hour==24)
date
+=1;
hour
=0;
}

//日期处理
if(month==1||month==3||month==5||month==7
||month==8||month==10||month==12)
{
if(date==32)
{
   date
=1;
   month
+=1;
   }

}
else if(month==4||month==6||month==9||month==11){
if(date==31){
   date
=1;
   month
+=1;
   }

}
else if(month==2){
   
if(year%4==0&&year%100!=0){//闰年处理
    if(date==29){
     date
=1;
     month
+=1;
    }

   }
else{
    
if(date==28){
     date
=1;
     month
+=1;
    }

   }

}

if(month==13){
year
+=1;
month
=1;
}

sseco
=addZero(seco);
sminu
=addZero(minu);
shour
=addZero(hour);
sdate
=addZero(date);
smonth
=addZero(month);
syear
=year;

document.getElementById('
1').innerHTML=jdate;
document.getElementById('
2').innerHTML=jhour;
document.getElementById('
3').innerHTML=jminu;
document.getElementById('
4').innerHTML=jsecond;
setTimeout(
"getSeverTime()",1000);
}


function addZero(num) {
num
=Math.floor(num);
return ((num <= 9? ("0" + num) : num);
}
页面调用time.htm
<script src="xctime.js"></script>
<body onload="setInterval(getSeverTime,1000);">
<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
<div id="4"></div>
</body>