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