函數名clock與getElementById("clock")的clock
這兩個clock是“同一個”嗎?因為我把函數名改了好像沒有影響?
var?attime; ??function?co(){ ????var?time=new?Date();????????? ????attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds(); ????document.getElementById("clock").value?=?attime; ??} var?int=setInterval(co,100);
2016-03-20
不是同一個 getElementById(); ?注意后半段 ById(). ? 說明里面是某個標簽的ID。 ?跟函數名無關