问:
我希望实现进入界面显示进入界面的时间
回答:
// 等待页面加载完成后执行 显示时间
document.addEventListener('DOMContentLoaded', function() {
// 获取当前时间
const now = new Date();
const timestampElement = document.getElementById('timestamp');
timestampElement.textContent = now.toLocaleString();
});