0

I am supposed to have a scrolling marquee on my page, but I am having errors trying to get it to work. here is my js context. Any help would be great!

var timeID;
var marqueeTxt = new Array();
var marqueeOff = true;

window.onload = defineMarquee;

function defineMarquee(){
	var allElem = document.getElementsByTagName("*");
	
	for (var i=0; i<allElem.length; i++){
		if (allElem[i].className == "marqueeTxt") marqueeTxt.push(allElem[i]);
	}
	
	for (i=0; i<marqueeTxt.length; i++){
		if (window.getComputedStyle){
			var firstValue = marqueeTxt[i].currentStyle["top"];
		}else if (marqueeTxt[i].currentStyle){
			firstValue = marqueeTxt[i].currentStyle["top"];
		}
	}
	
	document.getElementById("startMarquee").onclick = startMarquee;
	document.getElementById("stopMarquee").onclick = stopMarquee;
	
}

function startMarquee(){
	if(marqueeOff){
		timeID = setInterval("moveMarquee()",50);
		marqueeOff = false;
	}
}

function stopMarquee(){
	clearInterval(timeID);
	marqueeOff = true;
}

function moveMarquee(){
	for(var i=0; i<marqueeTxt.length; i++){
		var topPos = parseInt(marqueeTxt.style.top);
		
		if (topPos < -110){
			topPos = 700;
		}else{
			toPos -= 1;
		}
		
		marqueeTxt.style.top = topPos + "px";
	}
}
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by hielo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.