I usually use some "pre-load" code in my pages to preload graphics
that will be swapped. But, I'm thinking that rather than the
long, repetitive, once, for each graphic hardcoded stuff like this:
var bb_off = new Image();
bb_off.src = "images/bb_off.jpg";
....that I could have an array where I just listed the names of the
graphics, a loop, and code in the loop that cycles through each
entry in the array to create and pre-load the "on" and "off"
graphics with code in the loop something like this:
for (...){
var temp = array[index] // contains text name for graphic like bb_off
var eval(temp) = new Image();
eval(temp).src = "images" +
eval(temp) + ".jpg"
}
But, it seems to choke on the first line - creation of an object
with an "eval" name. I tried some tricks with string objects but
there seemed to be problems with that. I suppose I could use a
document.write and just generate the code, but that seems like a lot
of extra work for the browser/system. I'd also like to avoid use
of anything too DOM new as I want backwards compatibility to
NN4 at least. To top it off, my JS is a little rusty. Is there some
way to create a variable/object like this with a varying name in JS ?
Thanks,