码迷,mamicode.com
首页 > Web开发 > 详细

wordpress网站底部的运行时间是怎么设置的?

时间:2017-11-18 12:51:28      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:image   分享   title   class   width   img   timeout   none   floor   

别人网站底部显示的网站运行时间是什么设置的?是插件的效果吗?

不用插件,一段JS代码就可以实现同样的效果。

复制如下代码到 footer.php 页脚那里

<span id="runtime_span"></span><script type="text/javascript">function show_runtime(){window.setTimeout("show_runtime()",1000);X=new Date("11/11/2017 1:21:40");Y=new Date();T=(Y.getTime()-X.getTime());M=24*60*60*1000;a=T/M;A=Math.floor(a);b=(a-A)*24;B=Math.floor(b);c=(b-B)*60;C=Math.floor((b-B)*60);D=Math.floor((c-C)*60);runtime_span.innerHTML="网站已运行"+A+"天"+B+"小时"+C+"分"+D+"秒"}show_runtime();</script>

显示效果如下:

技术分享图片

 

原文链接:https://adcc.me/wordpress-174.html

wordpress网站底部的运行时间是怎么设置的?

标签:image   分享   title   class   width   img   timeout   none   floor   

原文地址:http://www.cnblogs.com/hylsay/p/7856155.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!