【发布时间】:2011-07-02 18:57:17
【问题描述】:
function timeClock()
{
setTimeout("timeClock()", 1000);
now = new Date();
alert(now);
f_date = now.getDate()+" "+strMonth(now.getMonth())+" "+now.getFullYear()+" / "+timeFormat(now.getHours(), now.getMinutes());
return f_date;
}
<span class="foo"><script type="text/javascript">document.write(timeClock());</script></span>
警报(现在);每秒给我一个值,但它没有在 html 中更新。如何在不刷新页面的情况下更新html上的时间?
【问题讨论】:
标签: javascript jquery datetime