I’ve been using Javascript for a while and I usually get things done (though, not always in the best way…:-))
I need to create a simple script to run a loop that has to output several strings.
Basically, what I need is to create a variables such as var title1 = “This is TITLE 1”; var title2 = “This is TITLE 2”; and so on. Then I need to run a loop:
for (i=i;i>=j;i=i-1) {
var whichTitle = ‘title_’ + i;
document.write(whichTitle);
}
The thing is rather than getting the text I’ve defined, I get title1 and title2 (not “This is TITLE 2”). For some reason, javascript’s not considering the original variables as the one’s needed to be passed. I’m sure I’m facing this the wrong way. HELP!!!