1 Star 0 Fork 0

Nyx/Nyx Ulric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 910 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nyx 提交于 2020-04-20 11:25 . JS计时器
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JS实现计时器(时、分,秒)</title>
</head>
<!-- September 19 2016 -->
<body>
<span id=nowtime></span>
<script>
//距离2016-09-19已经过去的时间 20160919
function getTheTime(){
var t=new Date() - new Date(2016,8,19);
var y=Math.floor(t/1000/60/60/24/365);
t-=y*1000*60*60*24*365;
var d=Math.floor(t/1000/60/60/24);
t-=d*1000*60*60*24;
var h=Math.floor(t/1000/60/60);
t-=h*1000*60*60;
var m=Math.floor(t/1000/60);
t-=m*1000*60;
var s=Math.floor(t/1000);
return y+""+d+""+h+""+m+""+s+"";
}
window.onload=function(){
setInterval("nowtime.innerHTML=getTheTime();",1000);
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/knicks/Nyx-Ulric.git
[email protected]:knicks/Nyx-Ulric.git
knicks
Nyx-Ulric
Nyx Ulric
master

搜索帮助