clearTimeout() not working on Web Server
<p>I have a simple 'timer' script embedded in php page which takes the variable 'totalTime' value from php script and runs for the specified total no of minutes and need to clear the setTimeout and close the window through window.close() method</p>

<p>this page is opened through window.open() method.</p>

<pre><code>var m=parseInt(totalTime);  
var ts=m*60;  
var c=m+' : 00';  
var timer_is_on=1;  
var timer="timer";  
function timedCount()  
{  
ts=ts-1;  
m=Math.floor(ts/60);  
var s=ts%60;  
c=m+" : "+s;  
document.getElementById('timer').innerHTML=c;  
if(ts==0){  
alert("Time Out");  
clearTimeout(timer);  
window.close();  
}  
else {  
timer=setTimeout("timedCount()",1000);  
}  
}  
function countTime()  
{  
if (timer_is_on)  
  {  
  timedCount();  
  }  
}  
</code></pre>

<p>The timer is running until its 0:0 and instead of the popup window being closed, the timer is showing negative numbers.</p>

<p>Neither the clearTimeout() nor window.close() is working.</p>

<p>I had tested it on localhost before it was working fine.</p>

<p>I have tried a lot on stackoverflow asl well as other sites to get a hint but was helpless...</p>

<p>So please help me out..
Thanks</p>
