纯JS实现动态时间显示代码
摘要:复制代码代码如下:无标题文档vart=null;t=setTimeout(time,1000);//开始执行functiontime(){c...
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<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>
</head>
<body>
<label id="timeShow"></lable>
</body>
</html>
【纯JS实现动态时间显示代码】相关文章:
★ 鼠标图片振动代码
★ 强制设为首页代码
★ jQuery Timelinr实现垂直水平时间轴插件(附源码下载)
上一篇:
js数字转换为float,取N位小数