1
0
Fork 0
php-coding/realtime.js

7 lines
247 B
JavaScript

function showCurrentTime() {
const CurrentTime = new Date();
document.getElementById('time').innerHTML = CurrentTime.toLocaleString();
}
window.onload = showCurrentTime(); // 页面加载完毕后执行
setInterval(showCurrentTime, 1000);