title: Creating a new line for an output using the same variable?
body: <p>Very much a newbie here and wanting a bit of guidance.</p>
  
  <p>I'm trying to create a project where you bind a key to start a timer then show an output in the results box. However i'm facing an issue where I need to create a new line if the user releases the bound button to start a new timer, however I can't find a way to start the timer again. Bear in mind within the time, a user could press the bound key over a hundred times, I don't want to manually create new lines and timer's.</p>
  
  <p>My thoughts are creating a a random token, then on release, it creates a break, if the next line doesn't match this token it begins again.</p>
  
  <p>Edit:So you can see, the value is based on the 2 variables, and even when I hold down the specific button again, it just adds to the current smallTime. I know this is how it's currently build, but i'm trying to get it to reset and go to the next line dynamically.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
  
        &lt;textarea class="code_input" name="allInputs" id="textareaCode" wrap="logical" rows="10"    cols="50" readonly="true"&gt; &lt;/textarea&gt;
  
  
        &lt;script type="text/javascript"&gt;
  
  
          var shortSeconds = 0;
          var shortmillisec = 0;    
  
  
          function buttonPressed(e) {
            key = String.fromCharCode(e.keyCode).toLocaleLowerCase()
        //alert (key)
            keyInput = e.keyCode
  
            if (withinTime == true &amp;&amp; key == bind) {
              shortDisplay()
              shortTimerFunction();
            }
          }
  
          function shortDisplay() {
            if (shortmillisec &gt;= 9) {
              shortmillisec = 0
              shortSeconds += 1
            }
            else
              shortmillisec += 1
          }
  
  
          function startstoptimerShort() {
            if (shortTimer &gt; 0) {
              clearTimeout(shortTimer);
              shortTimer = 0;
            } else {
              withinTime = true
              shortTimerFunction()
            }
          }
  
          function shortTimerFunction() {
            smallTime = shortSeconds + "." + shortmillisec;
            shortTimer = setTimeout("shortTimerFunction()", 100);
  
            //need to work out what line to put the output on
            allInputs = document.getElementById('textareaCode')
            allInputs.value = (textbox3.value) + (":  " + smallTime) + '\n';
          } 
  
        &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>