JavaScript 参考手册
JavaScript setSeconds() 方法
把当前时间的秒字段设置为 35
源代码:
点击运行 »
<p id="demo">单击按钮显示修改秒数后的时间</p> <button onclick="myFunction()">点我</button> <script> function myFunction() { var d = new Date(); d.setSeconds(35); var x = document.getElementById("demo"); x.innerHTML = d; } </script>
运行结果:
点击运行 »