Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> useless setInterval call
marcini82
post
Post #1





Grupa: Zarejestrowani
Postów: 190
Pomógł: 1
Dołączył: 20.05.2005
Skąd: Poznań

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


Witam!

Usiluje napisac sobie obiekt sluzacy do przesuwania tekstu wewnatrz diva.
Oto zaczatki kodu:

  1. function Scroller(divId, direction) {
  2.  
  3. this.divId = divId;
  4. this.direction = direction;
  5. this.timeout = 0;
  6. this.interval = 0;
  7. this.startDelay = 0;
  8. this.stopDelay = 8000;
  9. this.stepDelay = 50;
  10.  
  11. this.startScrollNow = function(){
  12. var div = document.getElementById(this.divId);
  13. //div.scrollLeft = 0;
  14. this.interval = setInterval(this.nextStep, 25); // tu zglasza blad
  15. }
  16.  
  17. this.nextStep = function(){
  18. var staryScroll = div.scrollLeft;
  19. div.scrollLeft++;
  20.  
  21. }
  22.  
  23. }

Potem sobie to uruchamiam:
  1. var newsScroll = new Scroller("pasek_news", "left");
  2. newsScroll.startScrollNow();


Problem w tym, ze w linii gdzie jest setInterval() konsola js w Firefoksie wyrzuca blad:
Cytat
Błąd: useless setInterval call (missing quotes around argument?)


Jak zamiast this.nextStep dam nextStep, to pisze ze nie ma takiej funkcji...

Co jest zle?
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: 24.08.2025 - 23:08