获取系统的当前时间
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/jscript">
function showtime(){
var date=new Date();
var st=document.getElementById("time");
var weekday=new Array(7)
weekday[0]="星期日"
weekday[1]="星期一"
weekday[2]="星期二"
weekday[3]="星期三"
weekday[4]="星期四"
weekday[5]="星期五"
weekday[6]="星期六"
var hour= date.getHours();
hour=(date.getHours()<12)?date.getHours():date.getHours()-12;
hourap=(date.getHours()<12)?"AM":"PM";
st.innerHTML= date.getFullYear()+"年"+ (date.getMonth()+1)+"月"+ date.getDate()+"日"+" " + hour
+":"+ date.getMinutes()+":"+ date.getSeconds()+" "+hourap +weekday[date.getDay()];
}
var zou=window.setInterval("showtime()",1000);
</script>
</head>
<body onload="showtime()"> <h1 id="time"> </h1>
</body> </html>