Usiluje napisac sobie obiekt sluzacy do przesuwania tekstu wewnatrz diva.
Oto zaczatki kodu:
function Scroller(divId, direction) { this.divId = divId; this.direction = direction; this.timeout = 0; this.interval = 0; this.startDelay = 0; this.stopDelay = 8000; this.stepDelay = 50; this.startScrollNow = function(){ var div = document.getElementById(this.divId); //div.scrollLeft = 0; this.interval = setInterval(this.nextStep, 25); // tu zglasza blad } this.nextStep = function(){ var staryScroll = div.scrollLeft; div.scrollLeft++; } }
Potem sobie to uruchamiam:
var newsScroll = new Scroller("pasek_news", "left"); 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?