js代码
<script type="text/javascript"> var divH = document.getElementsByClassName("time_h") var divM = document.getElementsByClassName("time_m") var divS = document.getElementsByClassName("time_s") setInterval(function() { var newtime = new Date() var h = newtime.getHours() var m = newtime.getMinutes() var s = newtime.getSeconds() console.log(h,m,s) divH[0].style.transform = "rotate(" + (-90 + h * 30) + "deg)" divM[0].style.transform = "rotate(" + (-90 + m * 6) + "deg)" divS[0].style.transform = "rotate(" + (-90 + s * 6) + "deg)" }, 1000) </script>