代码如下:
<!DOCTYPE HTML PUBLIC "//WC//DTD HTML Transitional//EN" "
<html>
<head>
<meta httpequiv="ContentType" content="text/html; charset=utf" />
<script type="text/javascript">
function bodyLoad(){
var dateTime=new Date();
var hh=dateTimegetHours();
if(hh<) hh = + hh;
var mm=dateTimegetMinutes();
if(mm<) mm = + mm;
var ss=dateTimegetSeconds();
if(ss<) ss = + ss;
var yy=dateTimegetFullYear();
var MM=dateTimegetMonth()+; //因为月这个方法返回为所以加
var dd=dateTimegetDate();
var week=dateTimegetDay();
var days=[ "日 " "一 " "二 " "三 " "四 " "五 " "六 "]
documentgetElementById("date")value=yy+"年"+MM+"月"+dd+"日 "+"星期"+days[week] ;
documentgetElementById("time")value=hh+":"+mm+":"+ss;
setTimeout(bodyLoad);
}
</script>
</head>
<body onload="bodyLoad()">
<input type="text" id="date" style="border: none;" /><input type="text" id="time" style="border: none;" />
</body>
</html>