两者区别是什么,为什么第二个会出现这种情况?
var attime;
function clock(){
var time=new Date();
attime= time.getHours()+":"+time.getMinutes()+":"+time.getSeconds() ; ;
document.getElementById("clock").value = attime;
}
setInterval(clock,1000);
var attime;
function clock(){
var time=new Date();
attime= time.getHours()+":"+time.getMinutes()+":"+time.getSeconds() ; ;
document.write(attime);
}
setInterval(clock,1000);