首页

动态时钟

#clock{

margin:100px auto;

border: 5px double green;

width: 400px;

height: 100px;

line-height: 100px;

text-align: center;

font: bold;

color: red;

}

function showTime(clock){

var now = new Date();

var year = now.getFullYear();

var month= now.getMonth();

var day = now.getDate();

var hour = now.getHours();

var minu = now.getMinutes();

var second = now.getSeconds();

month = month+1;

var arr_work = new Array(“星期日”,”星期一”,”星期二”,”星期三”,”星期四”,”星期五”,”星期六”);

var week = arr_work[ now.getDay()];

var time = year+”年”+month+”月”+day+”日 “+ week+” “+hour+”:”+minu+”:”+second;

clock.innerHTML=”当前时间: “+time;
}

window.onload = function(){

var clock = document.getElementById(“clock”);

window.setInterval(“showTime(clock)”,1000);
}

通过 WordPress.com 设计一个这样的站点
从这里开始