I have a newscroller.js which contains amongst lots of other stuff the following:
As you can see it defines NewsScroller_StartScrolling and NewsScroller_StopScrolling, which are the 2 lines I have to show you before I continue.
function NewsScroller ()
if (window.NewsScrollerInstance != null)
window.alert("Only one NewsScroller control is allowed on a page.");
window.NewsScrollerInstance = this;
this.LoadXML = NewsScroller_LoadXML;
this.AddNewsItem = NewsScroller_AddNewsItem;
this.Clear = NewsScroller_Clear;
this.StartScrolling = NewsScroller_StartScrolling;
this.StopScrolling = NewsScroller_StopScrolling;
this.Render = NewsScroller_Render;
Both of those are scripted like this:
function NewsScroller_StartScrolling ()
if (this.itemCount > 0)
var sControlName = this.renderedControl;
if (sControlName == null)
window.alert ("You must render a control before you can start scrolling it.");
var elmControl = document.getElementById(sControlName);
var elmItem0 = document.getElementById("floatingNews0");
if (this.itemCount > 1)
var elmItem1 = document.getElementById(sControlName + "1");
this.cySeparator = (elmItem1.offsetTop - elmItem0.offsetTop) - elmItem0.offsetHeight;
this.cySeparator = 0;
if (this.ScrollTimerID == null)
this.ScrollTimerID = window.setInterval(NewsScroller_ScrollNews, this.scrollRate);
function NewsScroller_StopScrolling ()
this.ScrollTimerID = null;
Now.. the problem i have is with my HTML page where I call this scroller applet. What happens now is that the whole thing scrolls all the way through without stopping. What I want is for onMouseOver to call the eventhandler "StopScrolling" and then on mouseout for it to null that by calling "startscrolling"
My HTML code is this:
As you can see I've tried to stick the onMouseOver etc in there but I blatently dont know how to work it.
var scrollerMain = new NewsScroller("main");
<xml id="xmlNews" src="xmlNews.xml"></xml>
<div style="float: right; width: 200px; height: 250px;">
scrollerMain.onMouseOver = (StopScrolling);
scrollerMain.onMouseOut = (StartScrolling);
Here is the helpful FAQ that came with this, taken from this page
Pause when hovering
For this feature, you do not need to change the newsscroller.js script at all. In your page, after calling the Render method of the NewsScroller object, attach onmouseover and onmouseout event handlers to the element that contains your rendered NewsScroller object. In the handler for the onmouseover event, call the StopScrolling method, and in the handler for the onmouseout event, call the StartScrolling method.
Sorry to make this a long post but I thought it was better to explain things clearly rather than just dump code on you and expect a quick answer.