W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>单击按钮可在更改秒和毫秒后显示它们。</p> <button onclick="myFunction()">试一试</button> <p id="demo"></p> <script> function myFunction() { var d = new Date(); d.setUTCSeconds(35, 825); var s = d.getUTCSeconds(); var ms = d.getUTCMilliseconds(); var x = document.getElementById("demo"); x.innerHTML = s + ":" + ms; } </script> </body> </html>