码迷,mamicode.com
首页 > 编程语言 > 详细

javascript (java)动态时钟

时间:2019-06-06 15:53:21      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:script   gets   function   inner   show   UNC   时钟   time()   min   

<script language="javascript">
var t = null;
t = setTimeout(time,1000);//开始执行
function time()
{
clearTimeout(t);//清除定时器
dt = new Date();
var h=dt.getHours();
var m=dt.getMinutes();
var s=dt.getSeconds();
document.getElementById("timeShow").innerHTML = "现在的时间为:"+h+"时"+m+"分"+s+"秒";
t = setTimeout(time,1000); //设定定时器,循环执行
}
</script>
<label id="timeShow"></lable>

javascript (java)动态时钟

标签:script   gets   function   inner   show   UNC   时钟   time()   min   

原文地址:https://www.cnblogs.com/1906396809liufg/p/10984975.html

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