此代碼顯示了一個正在增長的間隔計時器。我正在使用setInterval,但我不知道如何停止ist。有一個叫做恩德()的放克。我可以用這個放克停止間隔計時器嗎?停止它的原因是,當我再次按下按鈕(在底部)時,第二個計時器就會啟動。我不知道怎么說,測試一下。```<!DOCTYPE html><html> <head> <title>Interval Timer</title> <style> @font-face { font-family: sevenSegment; src: url(SevenSegment.ttf); } h1{ font-family: sevenSegment; font-size: 7em; color: #969696; line-height: 0%; } h2{ font-family: sevenSegment; font-size: 5em; color: #969696; line-height: 0%; } .container{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50% ); } .button1{ font-family: sevenSegment; font-size: 1em; color: #969696; border: none; } </style> </head> <body> <div class="container"> <table> <tr> <td><h2 id="des">WORK</h2></td> </tr> <tr> <td><h1 id="count">00:00:45</h1></th> </tr> <tr> <td><h2 id="des">REST</h2></td> </tr> <tr> <td><h1 id="count2">00:00:15</h1></td> </tr> <tr> <td><h2 id="des">Pause</h2></td> </tr> <tr> <td><h1 id="count3">00:00:25</h1></td> </tr> </table> <button class="button1" type="button" id="work">Work</button> <button class="button1" type="button" id="rest">Rest</button> <button class="button1" type="button" id="pause">Pause</button> </div>
如何從 HTML 中停止“設置間隔”
RISEBY
2022-09-23 16:19:44
