problems with setInterval

A

allanrodkin

Hi, if you don't have time, please just look at one line marked by the
stars


I am trying to use the following code to eventually scroll text across
the screen. The body of the page contains a number of div text blocks
and I would like for them to scroll across the screen sequentially. I
have a two dimensional array called myArray(). It contains a reference
to the div text block, and the corresponding element, which specifies
whether the text block is a head text block or content text box. The
myArray [2][1] in the code below specifies "even" which means its a
content block. I know this hardcoding is amateur programming.

I obtain the reference to the div block:
var paraTwo = document.getElementById("paraTwoID");
myArray[2][0] = paraTwo;
myArray[2][0].innerHTML = "<div>" + paraTwo.innerHTML + "</div>";
myArray[2][1]="even";

Eventually I'd like to manipulate the code by changing the left
position of each div block, creating animation. However I'm trying to
use the setInterval function to sequentiall increment the left syle
position. I have been using a nested loops to this, which I'm guessing
causes complications with time sequences.

for (loopCounter1 = 1; loopCounter1 < 7; loopCounter1++)
{

for (loopCounter2 = 0; loopCounter2 < 2; loopCounter2++)
{
if ((myArray[loopCounter1][loopCounter2])=="odd")
{

//*****************************
setInterval("moveParas1()", 5000);

}

}

}

function moveParas1()
{
alert("This is test =" + myArray[1][0].innerHTML);

}

Anyways, I keep getting the error "ERROR moveParas1 is not defined"

Anyways, I'd appreciate any explanation of how I am using setInterval()
incorrectly.

Thanks,
Allan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top