I have the following JS code and I try to access the functions start()
and stop()
from a div
with the events onmouseover=""
and onmouseout=""
:
NewsScroller = function(id, speed) {
this.start = function() {
_timer = window.setInterval(self.doScroll, this.scrollSpeed);
};
this.stop = function() {
if (_timer) window.clearInterval(_timer);
};
};
var scroll = new NewsScroller('marquesina', 10);
<div id="marquesina" onmouseover="scroll.stop();" onmouseout="scroll.start();">
Soy una Marquesina
</div>
But when executing it tells me that start
and stop
are not functions.
How else can I have the nested functions called to work?