<!DOCTYPE?html>
<html>
<head>
<meta?http-equiv="Content-Type"?charset="UTF-8">
<title></title>
<style?type="text/css">
#show{width:?500px;height:?500px;}
</style>
<script?language="javascript"?type="text/javascript">
?????window.onload?=?function(){
showtime();
}
function?checkTime(i)
{
if?(i<10)?
??{i="0"?+?i}
??return?i
}
function?showtime()
{
var?now=new?Date();
?????var?year=now.getFullYear();
?????var?month=now.getMonth()+1;
?????var?day=now.getDate();
?????var?h=now.getHours();
?????var?m=now.getMinutes();
?????var?s=now.getSeconds();
?????m=checkTime(m);
??????s=checkTime(s);
var?week=new?Array(7)
?????week[0]="星期日"
?????week[1]="星期一"
?????week[2]="星期二"
?????week[3]="星期三"
?????week[4]="星期四"
?????week[5]="星期五"
?????week[6]="星期六"
document.getElementById("show").innerHTML=""+year+"年"+month+"月"+day+"日"+week[now.getDay()]+h+":"+m+":"+s?;
t=setInterval("showtime()",500)
}
</script>
</head>
<body>
<div?id="show">dfsfd</div>
</body>
</html>
我這段時(shí)鐘程序?yàn)槭裁催\(yùn)行一會(huì)就崩潰了?
黃志明
2016-04-07 17:02:20