Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]Zatrzymanie setInterval
arzach
post
Post #1





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 27.11.2008

Ostrzeżenie: (0%)
-----


Zrobiłem taki kod

Kod
var intervalHandler=setInterval(stoper,1000);

<span
style="cursor: pointer; text-decoration: underline"
onmouseover="clearInterval(intervalHandler)">
Stop
</span>


i po najechaniu zatrzymuje mi się odliczanie i chciał bym dodać do tego że jak zjadę z linka to wznowi mi się odliczanie i zrobiłem tak
Kod
<span
style="cursor: pointer; text-decoration: underline"
onmouseover="clearInterval(intervalHandler)" onmouseout="clearInterval(intervalHandler)">
Stop
</span>

i nie działa.
Wie ktoś czemu ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
arzach
post
Post #2





Grupa: Zarejestrowani
Postów: 332
Pomógł: 6
Dołączył: 27.11.2008

Ostrzeżenie: (0%)
-----


Jakie zerowanie ?

To jest cały kod
Kod
<script type="text/javascript">
var ile=12;

function stoper()
{
godzin=Math.floor(ile/3600);
minut =Math.floor(ile/60)%60;
sekund =ile%60;
document.getElementById('div1').innerHTML = 'Pozostalo: '+minut+' minut '+sekund+' sekund';
ile--;

if(ile<0){
clearInterval(intervalHandler);
alert("Czas na rozwiązanie quizu minoł!");
setTimeout("document.formularz.submit()", 3000)
}

}
var intervalHandler=setInterval(stoper,1000);


</script>

<span
style="cursor: pointer; text-decoration: underline"
onmouseover="clearInterval(intervalHandler)">
Stop
</span>

I jak najade na link to sie zatrzymuje stoper ale już nastałe a chce dodać że jak zjade z linka to wznowiło sie odliczanie

Ten post edytował arzach 29.11.2008, 21:26:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 11:10