```javascriptvar speed = 40;
var fdemo = document.getElementById("fdemo");
var fdemo1 = document.getElementById("fdemo1");
var fdemo2 = document.getElementById("fdemo2");
fdemo2.innerHTML = fdemo1.innerHTML;
function Marquee() {
if (fdemo2.offsetWidth - fdemo.scrollLeft <= 0) {
fdemo.scrollLeft -= fdemo1.offsetWidth;
} else {
fdemo.scrollLeft++;
}
}
var MyMar = setInterval(Marquee, speed);
fdemo.onmouseover = function () {
clearInterval(MyMar);
};
fdemo.onmouseout = function () {
MyMar = setInterval(Marquee, speed);
};
```