翻阅古今
<p></p><input type="button" value="提交" onclick="test()"><script> var count = 1800; var p = document.querySelector('p') var intervalId = window.setInterval(countDown, 1000) function countDown() { --count p.innerText = timeFormat() } function test() { count += 60 * 60 p.innerText = timeFormat() } var hour, minute, second var timeText; function timeFormat() { hour = Math.floor(count / (60 * 60)); minute = Math.floor(count / 60) - (hour * 60); second = Math.floor(count) - (hour * 60 * 60) - (minute * 60); timeText = hour + ':' + minute + ':' + second return timeText }</script>