このタイマーがあります (以下のコードを参照)。ブラウザウィンドウがonFocus
.
(たとえば、ユーザーが別のウィンドウを開いた場合に一時停止したい。)
//Countdown
function timerCountdown()
{
x=100;
document.getElementById('timer1').value=x;
x=x-1;
t=setTimeout("timerCountdown()",1000);
if (c<-1)
{
document.getElementById('timer1').value='Go';
clearTimeout(t);
}
}