网站运行时间的js代码。
PS:此代码需要jquery支持
<html> <span id="run_time"></span> </html>
<script>
function runTime(){
var d = new Date(),str = '';
BirthDay=new Date("may 11,2016");
today=new Date();
timeold=(today.getTime()-BirthDay.getTime());
sectimeold=timeold/1000
secondsold=Math.floor(sectimeold);
msPerDay=24*60*60*1000
e_daysold=timeold/msPerDay
daysold=Math.floor(e_daysold);
str = "网站已经运行: "+daysold+"天";
str += d.getHours()+'时';
str += d.getMinutes()+'分';
str+= d.getSeconds()+'秒';
return str;
}
setInterval(function(){$('#run_time').html(runTime())},1000);
</script> 本文TAG:时间代码
猜你喜欢
- 2017-03-15天猫默认模块去除白色背景
- 2017-01-30利用PHP获取本机IP地址
- 2016-11-20把百度的站内搜索集成到任意网站上
- 2016-10-18如何去掉多说评论的的版权声明
- 2016-08-06CSS图片大小如何自动缩放
- 2016-06-29网站添加已运行时间代码及年月日时分秒js代码



本文暂时没有评论,来添加一个吧(●'◡'●)