微信

js 当前系统时间

 <script language=Javascript> 
  function time(){
    //获得显示时间的div
    t_div = document.getElementById('showtime');
    
    
   var now=new Date()
    //替换div内容 
    t_div.innerHTML = "现在是"+now.getFullYear()//年份
    +""+(now.getMonth()+1)//月份
    +""+now.getDate()//
    +""+now.getHours()//
    +""+now.getMinutes()//分钟
    +""+now.getSeconds()+"";////等待一秒钟后调用time方法,由于settimeout在time方法内,所以可以无限调用
  
  setTimeout(time,1000);
  }
</script>

 

posted @ 2014-10-31 10:47  Admin_info  阅读(136)  评论(0编辑  收藏  举报
青春时代是一个短暂的美梦,当你醒来时,这早已消失得无影无踪了。
点点Admin_info