
var timerID = 0;  //最後に仕掛けた時限装置のID
var counter = 0; //何秒経ったか
var MAXLIMIT = 10;//10秒経ったら止める
var DELAY = 1000;//タイマーの間隔（何１／１０００秒後）

function bomb()
{
		//カウンターの値をインクリメント
		//その値をフォームのテキストフィールドに入れる
		//またタイマーを仕掛ける
		//counter = counter + 1;
		//counter += 1;
		counter++;
		document.form1.text1.value = counter;		
		timerID = setTimeout("bomb()",DELAY );
		//実行関数に引数を与える場合、
		//グローバル変数以外は無効
		//混乱の元なので引数を使わない
}

function bomb2()
{
		counter--;
		document.form1.text1.value = counter;		
		timerID = setTimeout("bomb2()",DELAY );
		
		if ( counter == 3 )
		{
			document.bgColor ="ff0000";
		}
		else if ( counter == 2)
		{
			document.bgColor ="ffff00";
		}
		else if ( counter == 1)
		{
			document.bgColor ="ff00f0";
		}
		else if ( counter == 0)
		{
			document.bgColor ="000000";
		}
		
	}
		


function stopBomb()
{
	clearTimeout( timerID );
}


function init()
{
		//タイマーを仕掛ける
		counter = 5;
		timerID = setTimeout("bomb2()", DELAY );
}


<!--
//-->
