Scrolling Text Using JavaScript

I need to get my text to scroll back and forth and then have it switch colors from blue to red every 5 pixels. Any help would be appreciated. Thanks in advance.

//ScrollText javascript code

function initText(){
	dom = document.getElementById('theText').style;

//Current position
var x = dom.left;
var y = dom.top;

//Covert string to numbers and strip off units
x = x.match(/\d+/);
y = y.match(/\d+/);

//call the function that moves it
moveText(x, y);
}

if (y != finaly)
	if (y > finaly) y --;
		else if (y , finaly) y++;
		

if ((x != finalx) || (y != finaly)) {

	dom.left = x + "px";
	dom.top = y + "px";
	
	setTimeout("moveText(" + x + "," + y + ")", 1);
	}
}

What’s not working? The scrolling? I don’t see any code where you attempted to change the color.

Sponsor our Newsletter | Privacy Policy | Terms of Service