<!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>
Caballarii
相关分类