方法二:
1.用服务器时间,配合ajax
2.使用js的setInterval函数.
简单代码测试.
function getNowTime(){
var now = new Date();
document.getElementById("showTime").value
=now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();
document.getElementById("showTime").value+="
"+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
}
window.setInterval("getNowTime()",1000);