念念不忘
必有回响

WordPress美化,给博客底部添加网站运营时间

PO下js代码,可以自定义修改:

先配张图:

<p><span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span><script>// <![CDATA[
var now = new Date();
function createtime(){ var grt= new Date("1/4/2019 21:51:00");//此处修改你的建站时间或者网站上线时间
now.setTime(now.getTime()+250);
days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days);
hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;}
document.getElementById("timeDate").innerHTML = "小站在大风大浪中已安全行驶"+dnum+"天";
document.getElementById("times").innerHTML = hnum + "小时" + mnum + "分" + snum + "秒"; }
setInterval("createtime()",250);
// ]]></script>
</p>

 

赞(0) 打赏
未经允许不得转载:小蚁上树 » WordPress美化,给博客底部添加网站运营时间
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址