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";
}
}