适用于ie6,7,8.及firefox.这段代码主要难点在于取得当时秒。ie不支持getSeconds()
function js_time(){
var now=new Date();
y=now.getFullYear();
m=now.getMonth()+1;
d=now.getDate();
hh=now.getHours();
mm=now.getMinutes();
var ss = now.getTime() % 60000;
ss = (ss - (ss % 1000)) / 1000;
if(m<10) m='0'+m;
if(d<10) d='0'+d;
if(hh<10) hh='0'+hh;
if(mm<10) mm='0'+mm;
if(ss<10) ss='0'+ss;
document.getElementById("#time").value=(y+"年"+m+"月"+d+"日"+" "+hh+":"+mm+":"+ss);
}