title: How do you display a message once a JavaScript function restarts?
body: <p>I'm wanting to know how to put a message in every time the timer starts over. And here is my code thus far:</p>
  <pre><code>&lt;head&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
  var c=10;
  var t;
  var timer_is_on=0;
  
  function timedCount() {
      document.getElementById('txt').value = c;
      c = c - 1;
      if (c == 0)
          c = 10;
  
  }
  
  function doMining() {
      if (!timer_is_on) {
          timer_is_on = true;
          t = setInterval(function () {
              timedCount();
          }, 1000);                
      }
  }
  
  &lt;/script&gt; 
  
  &lt;SPAN STYLE=&quot;float:left&quot;&gt;
  &lt;form&gt;
  &lt;input type=&quot;button&quot; value=&quot;Mining&quot; onClick=&quot;doMining()&quot;&gt;
  &lt;input type=&quot;text&quot; id=&quot;txt&quot;&gt;
  &lt;/form&gt;
  &lt;/SPAN&gt;
  </code></pre>