Function calculating newTime - oldTIme to add points to a var seems to fail
<p>I have the following code:</p>

<ul>
<li>A div called "tm" in here a timer is ticking, e.g. 00:03:34
(hh:mm:ss) </li>
<li>I have a function called <code>setScore();</code> which is called
regular</li>
<li>I have the following vars:</li>
</ul>

<p>1: <code>var pointsAvailable = 40;</code></p>

<p>2: <code>var oldTime = 00:00:00;</code></p>

<p>Now I want to ad 10 points to pointsAvailable every time the function is called within 2 seconds. If it's longer, pointsAvailable must be set back to 40. Since the timer keeps on ticking, oldTime (which is the starting time) should be replaced by newTime (every time the function has run).</p>

<p>I came up with the following code:</p>

<pre><code>var pointsAvailable = 40; //start value
var oldTime = 00:00:00; //start value

function setScore() {
    var newTime = document.getElementById('tm').innerHTML; //get the time from div: 'tm' e.g. 00:00:02
    var findTime = (newTime - oldTime); //calculate the time in between e.g. 00:00:02 - 00:00:00 = 2

    if (findTime &lt; 3) { //is it smaller then 3?
        pointsAvailable += 10; //add 10 to the pointsAvailable
    } else { //is it 3 or bigger?
        pointsAvailable = 40; //set it back to 40
    }
    oldTime = newTime; //replace oldTime with newTime, so newTime becomes oldTime
}
</code></pre>

<p>But it isn't working. What am I doing wrong?</p>

<p>Kind regards,
Maurice</p>
