jquery动态显示当前时间

  1. html代码:<div id="current_time"></div>
  2. jQuery代码:
<script type="text/javascript">
  setInterval(function() {
      var now = (new Date()).toLocaleString();
      $('#current-time').text(now);
  }, 1000);
</script>

猜你喜欢

转载自blog.csdn.net/qq_36607076/article/details/79806613