<script language="vbscript">
<!--
'模仿GMT+8(实际是用户本地时间)
Dim A
A = Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
settimeout "clock",1000
sub clock()
y=Year(now)
mo=A(Month(now)-1)
d=Day(now)
if d<10 then d="0"&d
h=hour(now)
m=minute(now)
if m<10 then m="0"&m
s=second(now)
if s<10 then s="0"&s
nowtime=d&"."&mo&"."&y&" "&h&":"&m&":"&s&"(GMT+8)"
nowt.innerhtml=nowtime
settimeout "clock",1000
end sub
-->
</script>
<center id="nowt"></center>

解决方案 »

  1.   

    参考:<%
    dim timer
    timer=now
    %><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 2</title>
    <script language="javascript">
    <!--
    //获取本地时间与服务器时间的的差值(包括线路延迟等)
    var TimeLoc=new Date().getTime();//本地时间(ms)
    var TimeSer="<%=timer%>";//服务器时间=2009-2-22 19:37:27
    var TimeTmpArr=TimeSer.split(" ")
    var TimeTmp0Arr=TimeTmpArr[0].split("-")
    TimeSer=TimeTmp0Arr[1]+"-"+TimeTmp0Arr[2]+"-"+TimeTmp0Arr[0]+" "+TimeTmpArr[1]//JS时间格式字符串
    TimeSer=Date.parse(TimeSer)//服务器时间(ms)
    var TimeAdd=(TimeLoc-TimeSer)//本地时间与服务器时间的的差值(ms)var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
    function clock(){
    var nowTime=new Date().getTime()-TimeAdd//服务器当前时刻(ms)
    var date=new Date(nowTime)
    var y=date.getFullYear()
    var mo=date.getMonth();
    mo=A[mo];
    var d=date.getDate()
    var h=date.getHours()
    var m=date.getMinutes()
    var s=date.getSeconds()
    var nowtime=d+"."+mo+"."+y+" "+h+":"+m+":"+s+"(GMT+8)"
    return  nowtime
    }onload=function showTime(){
    document.getElementById("nowt").innerHTML=clock()
    setTimeout (showTime,1000)
    }//-->
    </script>
    </head><body>
    <center id="nowt"></center></body></html>
    (WixSp3IIS5通过)
      

  2.   

    谢谢,不过在火狐浏览器下面显示的是:
    NaN.undefined.NaN NaN:NaN:NaN(GMT+8)
    有支持火狐浏览器的吗?
      

  3.   

    放在服务器上测试也是一样的
    http://www.jhsybin.cn/temp/time.asp
      

  4.   

    试试
    TimeSer=TimeTmp0Arr[1]+"-"+TimeTmp0Arr[2]+"-"+TimeTmp0Arr[0]+" "+TimeTmpArr[1]//JS时间格式字符串改为
    TimeSer=TimeTmp0Arr[1]+"/"+TimeTmp0Arr[2]+"/"+TimeTmp0Arr[0]+" "+TimeTmpArr[1]//JS时间格式字符串