JS代码的浏览器兼容问题

求大家帮帮忙,我在js代码中写的是
window.onload=function(){setInterval(showtime,1000);}
function showtime(){
var current = new Date();
var t = document.getElmentById("time");
t.firstChild.innerText = current.toLocaleString();
}
此代码是在浏览器中实时显示本地时间
此代码在IE9,Chrome中运行正常,但是在火狐浏览器中不显示,为什么?

存在浏览器兼容性问题,需要对代码做修改,在火狐里面调试一下,可能会报错

t.firstChild.innerText = current.toLocaleString();

这段在firefox上不兼容

windows.onload不work,你应该在body里做

用 innerHTML = ...