Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a scrolling bar scroll forever?

Status
Not open for further replies.

pedros007

Programmer
Nov 14, 2004
8
0
0
GB
Hi,

I have created a javascript file and separate HTML file to make a scrolling news bar for the karting website which I maintain. I have made the javascript bar scroll without any problems, but I am having difficulties making it keep on scrolling. I have tried using the reload function but that stops it scrolling all together.

Javascript Code

var pos=100;
function Scroll() {
if (!document.getElementById) return;
obj=document.getElementById("thetext");
pos -=1;
if (pos < 0-obj.offsetHeight+130) return;
obj.style.top=pos;
window.setTimeout("Scroll();",30);
}

The html file uses the body onload function to call the javascript, and then the text contained within in its entered through a number of div's.

Any help would be much appreciated.

Thanks

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top