JS获取系统当前时间

//JS静态显示系统时间

JS获取系统当前时间—静态显示

</span></p><p><span style="white-space: nowrap;">//js获取日期</span></p><p><span style="white-space: nowrap;">function time()</span></p><p><span style="white-space: nowrap;">{</span></p><p><span style="white-space: nowrap;">  var now= new Date();</span></p><p><span style="white-space: nowrap;">  var year=now.getFullYear();</span></p><p><span style="white-space: nowrap;">  var month=now.getMonth();</span></p><p><span style="white-space: nowrap;">  var date=now.getDate();</span></p><p><span style="white-space: nowrap;">//写入相应id</span></p><p><span style="white-space: nowrap;">document.getElementById("date").innerHTML=</span></p><p><span style="white-space: nowrap;">year+"年"+(month+1)+"月"+(date)+"日";</span></p><p><span style="white-space: nowrap;">} </span></p><p><span style="white-space: nowrap;">

//JS动态显示系统时间

content="text/html; charset=UTF-8" />

<span style="line-height: 22.8571px;">JS动态显示时间</span><span style="line-height: 22.8571px;"></span>

</span></p><p><span style="white-space: nowrap;"><!--</span></p><p><span style="white-space: nowrap;">//获得当前时间,刻度为一千分一秒</span></p><p><span style="white-space: nowrap;">var initializationTime=(new Date()).getTime();</span></p><p><span style="white-space: nowrap;">function showLeftTime()</span></p><p><span style="white-space: nowrap;">{</span></p><p><span style="white-space: nowrap;">var now=new Date();</span></p><p><span style="white-space: nowrap;">var year=now.getYear();</span></p><p><span style="white-space: nowrap;">var month=now.getMonth();</span></p><p><span style="white-space: nowrap;">var day=now.getDate();</span></p><p><span style="white-space: nowrap;">var hours=now.getHours();</span></p><p><span style="white-space: nowrap;">var minutes=now.getMinutes();</span></p><p><span style="white-space: nowrap;">var seconds=now.getSeconds();</span></p><p><span style="white-space: nowrap;">document.all.show.innerHTML=</span><span style="white-space: nowrap; line-height: 1.42857;">""+year+"年"</span><span style="line-height: 1.42857; white-space: nowrap;">+month</span></p><p><span style="line-height: 1.42857; white-space: nowrap;">+</span><span style="line-height: 1.42857; white-space: nowrap;">"月"+day+"日 "+hours+":"+minutes+":"+seconds+"";</span></p><p><span style="white-space: nowrap;">//一秒刷新一次显示时间</span></p><p><span style="white-space: nowrap;">var timeID=setTimeout(showLeftTime,1000);</span></p><p><span style="white-space: nowrap;">}</span></p><p><span style="white-space: nowrap;">//--></span></p><p><span style="white-space: nowrap;">

本文地址:http://www.vnote.net/index.php?m=Home&c=Article&a=index&id=30


回复列表



回复操作

正在加载验证码......

请先拖动验证码到相应位置

发布时间:2015-10-13 10:09:26

修改时间:2015-10-13 10:09:26

查看次数:854

评论次数:0