var inp = document.getElementsByTagName("input"); //不应该用input的,没有意义,用span就挺好
change();
function change(){
var now = new Date();
inp[0].value = ((now.getHours()).toString()).replace(/^(\d)$/,"0$1");
inp[1].value = ((now.getMinutes()).toString()).replace(/^(\d)$/,"0$1");
inp[2].value = ((now.getSeconds()).toString()).replace(/^(\d)$/,"0$1");
setInterval(function (){change()},1000);
};
比实际时间快了一秒……