clearTimeout() Doesnt work
<p>When I double click, it seems that the <code>clearTimeout(timer)</code> doesnt work, and the code calls the <code>function activated(currentactiveid);</code> </p>

<p>But also the function inside the  <code>setTimeout("activated2('" + currentactiveid + "')", 2000);</code> references <code>timer</code>. So at the end I think that the problem is that the <code>clearTimeout</code> cannot find the variable <code>timer</code>.</p>

<p><strong>HTML:</strong></p>

<pre><code>&lt;td class='td2'  id='currentid1' ondblclick='activatedd(this);' onclick='dclickornot(this);'&gt;Some Text&lt;/td&gt;
</code></pre>

<p><strong>Javascript:</strong></p>

<pre><code>// Single Click 
function dclickornot(e)
{
    var currentactiveid = e.id;
    var timer = setTimeout("activated2('" + currentactiveid + "')", 2000);
}

// Double Click
function activatedd(e)
{
    clearTimeout(timer);
    var currentactiveid = e.id;
    activated(currentactiveid);
}
</code></pre>
