<!DOCTYPE html>
<html>
<head>
<title>timeShow</title>
<script src="file:///F:/front end/jquery/jquery-1.11.3.min.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
window.onload = function(){
showTime();
}
function showTime(){
var myDate = new Date();
var year = myDate.getFullYear();
var month = myDate.getMonth() + 1;
var date = myDate.getDate();
var dayArray = new Array(7);
dayArray[0] = "星期日";
dayArray[1] = "星期一";
dayArray[2] = "星期二";
dayArray[3] = "星期三";
dayArray[4] = "星期四";
dayArray[5] = "星期五";
dayArray[6] = "星期六";
var day1 = myDate.getDay();
var day = dayArray[day1];
var hour = myDate.getHours();
var minute = myDate.getMinutes();
var second = myDate.getSeconds();
var min = checkTime(minute);
var sec = checkTime(second);
var time1 = year + "年" + month + "月" + date + "日";
var time2 = hour + ":" + min + ":" + sec;
document.write(time1+day+time2);
setTimeout(showTime,800);
}
function checkTime(i){
if(i<10){
i = "0" + i;
}
return i;
}
</script>
</body>
</html>