JavaScript脚本如下:
<script language="javascript" type="text/javascript"> function show5() { if(!document.layers&&!document.all) return var Digital=new Date(); var hours=Digital.getHours(); var minutes=Digital.getMinutes(); var seconds=Digital.getSeconds(); var year=Digital.getFullYear(); var month=Digital.getMonth()+1; var date=Digital.getDate(); var day=Digital.getDay(); switch(day){ case 0:day="星期日";break; case 1:day="星期一";break; case 2:day="星期二";break; case 3:day="星期三";break; case 4:day="星期四";break; case 5:day="星期五";break; case 6:day="星期六";break; } var dn="上午" if(hours>12){dn="下午" }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 color=black>现在日期时间是:"+year+"年"+month+"月"+date+"日"+" "+day+" "+dn+" "+hours+" 时"+minutes+" 分"+seconds+" 秒"+"</font>"; if(document.layers){ document.layers.liveclock.document.write(myclock) document.layers.liveclock.document.close() }else if(document.all) sysTime.innerHTML=myclock setTimeout("show5()",1000) } </script>
在页面中的显示代码如下:
<span id="sysTime"></span>