Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js]funkcja która sam asie wykonuje
pys1986
post
Post #1





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 18.01.2005

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


jak powinna wyglądać funkcja która bedzie się wykonywała sama co np 2 sekundy (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
slammer
post
Post #2





Grupa: Zarejestrowani
Postów: 187
Pomógł: 6
Dołączył: 31.08.2005
Skąd: Bielsko-Biała

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


  1. <style type="text/css">
  2. #d2 {
  3. background: orange;
  4. display: none;
  5. }
  6. #d3 {
  7. background: red;
  8. display: block;
  9. }
  10. </head>
  11.  
  12. <script type="text/javascript">
  13.  
  14. function zmien() {
  15. el = document.getElementById("d2");
  16. e2 = document.getElementById("d3");
  17. if (el.style.display == "block") {
  18. el.style.display = "none";
  19. e2.style.display = "block";
  20. } else {
  21. el.style.display = "block";
  22. e2.style.display = "none";
  23. }
  24. }
  25.  
  26.  
  27. var uchwyt = setInterval("zmien()",2000);
  28.  
  29.  
  30.  
  31. <div id="d2">b</div>
  32. <div id="d3">c</div>
  33. <input type="button" value="zatrzymaj" onclick="clearInterval(uchwyt);" />
  34.  
  35.  
  36. </body>
  37. </html>
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: 14.10.2025 - 00:58