Log in

View Full Version : Timer with Javascript



Narfix
06-19-2006, 02:39 PM
Hello !

I have one little problem in one of my application.
I start a timer as I run a background work but the second time I start the background thing, the timer doesn't start.


function RunBackgroundTask() {
var mytimer = setTimeout("UpdateTimer()", 500);
LaunchAjaxthing();
}

function UpdateTimer() {
pct = oCIA.CIAReadData(sID,"PCT");
if(pct!="-1") {
setTimeout("UpdateTimer()", 500);
report.innerHTML="'" + pct + "'";
}
}

I didn't put all the details of RunBackgroundTask but if needed I will.

Thanks for the help !

Twey
06-19-2006, 03:17 PM
An URL to your page would be more helpful.

Narfix
06-19-2006, 03:25 PM
it's not public I'm afraid. I work on intranet applications :(

Nevermind... I figured it out.. I was reading my data before I even initialized (CIAReadData) it back to 0 the second time so it was stopping as soon as it started...
Ahhh... shame on me :)