网站底部添加运行时间代码自动计算精确到秒

代码描述:

直接添加网站底部合适位置即可,自动计算

代码截图:

图片[1]-网站底部添加运行时间代码自动计算精确到秒
图片[2]-网站底部添加运行时间代码自动计算精确到秒

代码:

<span id="runtime_span"></span>
<script type="text/javascript">
function show_runtime()
{window.setTimeout("show_runtime()",1000);
X=new Date("10/16/2017 5:22:00");
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> Date("10/16/2017 5:22:00")
© 版权声明
THE END
喜欢就支持一下吧
点赞31赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容