Forum Moderators: open
for (var x = 0; x <= thumbURL.length; x++) {
document.thumb+x.src = thumbURL[x];
}The 'document.thumb+x.src = thumbURL[x];' is where I'm having problems. It's not recognizing document.thumb+x How do I write that correctly?
Looks like you're trying to do an eval. As in:
eval("document.thumb" + x + ".src = " + thumbURL[x]);
eval takes a string and tries to execute it like code. I believe it's not great for performance, but should work.
Also, don't forget that arrays are zero indexed in JavaScript.