版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zlyaxixuexi/article/details/72802348
最近在搭建个人博客网站的过程中,掌握了如何在footer板块添加时间
- 效果图如下:
具体步骤
– 1,打开 next/layout/_partials文件夹下的 footer.swing文件
– 2,添加时间记录函数
window.onload = function() {
var show = document.getElementById("show");
setInterval(function() {
var time = new Date();
// 程序计时的月从0开始取值后+1
var m = time.getMonth() + 1;
//根据自己博客的创建时间更改数值
var t = "提示内容"+(time.getFullYear()-2017) + "年" + (m-3) + "月"
+ time.getDate() + "天 " + time.getHours() + "时"
+ time.getMinutes() + "分" + time.getSeconds() + "秒";
show.innerHTML = t;
}, 1000);
};
– 3,将show函数放在自己喜欢的位置即可。