i want to create a new variable with a variable name, for example:
function preloader(imglist) {
var imgs = imglist.split("|");
for (i in imgs) {
var img_{i} = new Image; //this is the line where i sucked in!
img_{i}.src = imgs[i]; //another line where i sucked in!
}
}
preloader("asd.jpg|qwe.jpg|dorama.png");
i try to use arrays but, hmm.. how can i say...
var qwe = new Array();
qwe[1] = "asd"; //or not! whatever...
var qwe[1] = new Image; // it didnt work!
in php u can use like this:
$var1 = "test";
$var2_{$var1} = "test last";
echo $var2_test; //or...
echo $var2_{$var1};