i dont know javascript terms very well and frequently interchange them so i apologize in advance.
an example of what i am trying to do is this
i have 5 <div id=”thingX”></div> objects on my page, where x is an incrementing number between 1 and 5
inside those tags is the letter e. in other words what gets displayed on the page is
e e e e e
now, in javascript what i have is a function similar to the following, in the attempts to change the e’s to a’s
function changePage(whichThing){
var tempoVar = “thing” + k
tempoVar.innerTEXT = “a”
k++;
if(k<5){
setTimeout(“changePage(k);”, 1);
}
}
the trouble is, javascript doesn’t seem to like it when i want to refer to an object by using a variable to replace the object, churning out “undefined” and the like.
so what i am asking is, how can i refer to an object, without actually directly typing the real object’s name myself. i imagine that without such functionality javascript would be very limited, so i’m going to assume that i’m just missing a fundamental aspect of js programming
any help is very much appreciated ?
-chris-