[Javascript] repeat script by timeout

Michael Borchers list at tridemail.de
Mon Aug 14 04:33:38 CDT 2006


> in your case I'd believe "setInterval" to be a best option
>
> Paul Novitski escreveu:
>
>> At 08:18 AM 8/10/2006, Michael Borchers wrote:
>>
>>> how do i realize the "every X seconds (=timeOut)) loop?!
>>
>>
>>
>> Gecko DOM Reference
>> DOM:window.setTimeout
>> http://developer.mozilla.org/en/docs/DOM:window.setTimeout

i realized it this way so far:

<script type="text/javascript">
function checkTasksReminders()
{
  timeoutID = window.setTimeout(getTasksReminders, 3000);
}

function getTasksReminders()
{
	// starting AJAX later...        alert("AJAX starting");
	checkTasksReminders();
}

function stop()
{
  window.clearTimeout(timeoutID);
}
</script>
</head>

<body onload="checkTasksReminders();">

<button onclick="stop();">Cancel</button>any reason i should do it 
different, f.e. with setInterval?! - examples?thanks




More information about the Javascript mailing list