75032
Oct 31, 2010
4121
4
0
Javascript Timer
Hi
ich bräuchte einen Timer also eine Funktion in Javascript, die z.B. alle 10 Sekunden eine andere Funktion ausführen.
Ich hab hier mal ein bisschen rumversucht aba ich kriegs nich hin...
function countdown(i) {
if (i == undefined) {
i = 10;
}
alert(i);
if (i > 0) {
i--;
var timeout = window.setTimeout("countdown(" + i + ")", 1000);
}
if (i = 0) {
i = 10;
contdown();
}
}
countdown();
Könnt ihr mir da helfen?
ich bräuchte einen Timer also eine Funktion in Javascript, die z.B. alle 10 Sekunden eine andere Funktion ausführen.
Ich hab hier mal ein bisschen rumversucht aba ich kriegs nich hin...
function countdown(i) {
if (i == undefined) {
i = 10;
}
alert(i);
if (i > 0) {
i--;
var timeout = window.setTimeout("countdown(" + i + ")", 1000);
}
if (i = 0) {
i = 10;
contdown();
}
}
countdown();
Könnt ihr mir da helfen?
Please also mark the comments that contributed to the solution of the article
Content-Key: 154083
Url: https://administrator.de/contentid/154083
Printed on: April 25, 2024 at 05:04 o'clock
4 Comments
Latest comment
die Funktion setInterval() im window Objekt wird Dir helfen.
http://de.selfhtml.org/javascript/objekte/window.htm#set_interval
.. so sollte es gehen.
http://de.selfhtml.org/javascript/objekte/window.htm#set_interval
iI = 10;
function countdown()
{
iI--;
alert(iI);
if (iI==0) {
window.clearInterval( oInterval );
}
}
oInterval = window.setInterval("countdown();", 1000);