<script language="javascript" type="text/javascript">
//author:玉匕首
//homePage:http://www.baiweiwu.cn
//date:2007.10.29
//Email:alexaren¥163.com
function GetRTime(){
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();
var EndTime= new Date(2008,8,8,20,0); //截止时间:2008年8月8日20时0分
var serverTime = new Date(year,month,date);//服务器端时间
var nMS =EndTime.getTime() - serverTime.getTime();
var nD =Math.floor(nMS/(1000 * 60 * 60 * 24));
var nH=Math.floor(nMS/(1000*60*60)) % 24;
var nM=Math.floor(nMS/(1000*60)) % 60;
var nS=Math.floor(nMS/1000) % 60;
if(nD>= 0){
document.getElementById("RemainD").innerHTML=nD;
if(nM>=10)
{
}
else
{
}
if(nS>=10)
{
}
else
{
}
}
else {
document.getElementById("CountMsg").innerHTML="北京2008奥运会开幕已经开幕";
}
setTimeout("GetRTime()",1000);
}
window.onload=GetRTime;
// -->
</script>
<table align="center">
<form id="form1" runat="server">
<tr>
<td align="center" valign="middle">
<div id="CountMsg" align="center">
<p align="center">距离北京2008奥运会开幕还有<span id="RemainD"></span>天</p>
</div>
</td>
</tr>
</form>
</table>