<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" charset="utf-8" />
<title></title>
<link rel="stylesheet" href="style.css" />
<script language="javascript" type="text/javascript">
window.onload = function(){
showTime();
}
//补位操作
function checkTime(i){
if(i<10){
return "0"+i;
}
else return i;
}
function showTime(){
var now=new Date();
var year= now.getFullYear() ;//年
var month= now.getMonth()+1 ;//月
var dt=now.getDate();//日
var day= now.getDay() ;//星期几
var h= now.getHours() ;//时
var m= now.getMinutes() ;//分
var s= now.getSeconds();//秒
m=checkTime(m);
s=checkTime(s);
//将获得数字星期和中文星期对应!
var weekday=new Array(7)
weekday[0]="星期日";
weekday[1]="星期一";
weekday[2]="星期二";
weekday[3]="星期三";
weekday[4]="星期四";
weekday[5]="星期五";
weekday[6]="星期六";
document.getElementById("show").innerHTML=""+year+"年"+month+"月"+dt+"日"+weekday[day]+h+":"+m+":"+s;
setTimeout("showTime()",500);
}
</script>
</head>
<body>
<div class="content1">
<div id="show">你好</div>
</div>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" charset="utf-8" />
<title></title>
<link rel="stylesheet" href="style.css" />
<script language="javascript" type="text/javascript">
window.onload = function(){
showTime();
}
//补位操作
function checkTime(i){
if(i<10){
return "0"+i;
}
else return i;
}
function showTime(){
var now=new Date();
var year= now.getFullYear() ;//年
var month= now.getMonth()+1 ;//月
var dt=now.getDate();//日
var day= now.getDay() ;//星期几
var h= now.getHours() ;//时
var m= now.getMinutes() ;//分
var s= now.getSeconds();//秒
m=checkTime(m);
s=checkTime(s);
//将获得数字星期和中文星期对应!
var weekday=new Array(7)
weekday[0]="星期日";
weekday[1]="星期一";
weekday[2]="星期二";
weekday[3]="星期三";
weekday[4]="星期四";
weekday[5]="星期五";
weekday[6]="星期六";
document.getElementById("show").innerHTML=""+year+"年"+month+"月"+dt+"日"+weekday[day]+h+":"+m+":"+s;
setTimeout("showTime()",500);
}
</script>
</head>
<body>
<div class="content1">
<div id="show">你好</div>
</div>
</body>
</html>