参考
<body bgcolor="#fef4d9" ONLOAD=show5()>
<CENTER><script language="JavaScript" src="news2.js" tppabs="http://www.coolyouth.net/baron/news2.js"></script></CENTER>
<span id=liveclock style=position:absolute;left:250px;top:122px;; width: 109px; height: 15px>
</span>
<SCRIPT language=javascript>
<!--
var Digital=new Date(2003,08,13, 13,34,34);function show5(){if(!document.layers&&!document.all)
return
Digital.setSeconds(Digital.getSeconds()+1)
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM"
if(hours>12){dn="PM"
hours=hours-12
}if(hours==0)
hours=12
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
//change font size here to your desire
myclock="<font size='5' face='Arial' ><b><font size='1'>Current Time:</font></br>"+hours+":"+minutes+":"
+seconds+" "+dn+"</b></font>"
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("show5()",1000)
}
//-->
</SCRIPT>
<body bgcolor="#fef4d9" ONLOAD=show5()>
<CENTER><script language="JavaScript" src="news2.js" tppabs="http://www.coolyouth.net/baron/news2.js"></script></CENTER>
<span id=liveclock style=position:absolute;left:250px;top:122px;; width: 109px; height: 15px>
</span>
<SCRIPT language=javascript>
<!--
var Digital=new Date(2003,08,13, 13,34,34);function show5(){if(!document.layers&&!document.all)
return
Digital.setSeconds(Digital.getSeconds()+1)
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM"
if(hours>12){dn="PM"
hours=hours-12
}if(hours==0)
hours=12
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
//change font size here to your desire
myclock="<font size='5' face='Arial' ><b><font size='1'>Current Time:</font></br>"+hours+":"+minutes+":"
+seconds+" "+dn+"</b></font>"
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("show5()",1000)
}
//-->
</SCRIPT>
<body onload=fnIntervalShow()><script language="JavaScript">
<!--
function fnShowDateAndTime() {
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day = now.getDay();
var Day = new Array(7);
Day[0]="星期天";
Day[1]="星期一";
Day[2]="星期二";
Day[3]="星期三";
Day[4]="星期四";
Day[5]="星期五";
Day[6]="星期六";
var timeValue = "";
timeValue += year + "年";
timeValue += ((month < 10) ? "0" : "") + month + "月";
timeValue += date + "日 ";
timeValue += (Day[day]) + " ";
timeValue += (hours < 12) ? "上午" : "下午";
timeValue += ((hours <= 12) ? hours : hours - 12);
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
document.Form1.tbShowTime.value = timeValue;
}
function fnIntervalShow() {
setInterval("fnShowDateAndTime()",1000);
}
//-->
</script>
<script language="JavaScript">
var sd = new Date(Date.parse("2003/08/13 13:34:34")); // 服务器时间
var bd = new Date(); // 本地时间
var dtime = bd.getTime() - sd.getTime(); // 本地时间与服务器时间差
function showTime() {
var d = new Date();
d.setTime(d.getTime()+dtime); // 矫正本地时间为服务器时间
document.form.showTime.value= d.toLocaleString().replace(/.+ /,''); // 显示时间
setTimeout("showTime()",1000)
}
</script>
<form name=form>
<INPUT name=showTime size=8>
</form>
</body>