js代码
<script> function displayTime() { var elt = document.getElementById("todaydatetime"); var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var s = now.getSeconds(); var ms = now.getMilliseconds(); elt.innerHTML =h + "小时:" + m + "分:" + s + "秒:" + ms; setTimeout(displayTime, 100); } displayTime(); </script>