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>
在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载