I am matching in the new text of JavaScript, but one ran into with a problem and I cannot find out how to solve it. Basically, which I want is to be able to partly use a variable of the name of a new object.
I am matching in the new text of JavaScript, but one ran into with a problem and I cannot find out how to solve it. Basically, which I want is to be able to partly use a variable of the name of a new object.
I think you wanted to do something like this :
Code:for (i = 0; i < selectedTypes[trendCategory].length; i++) var selectId = 'dynamicSelect' + i; document.getElementById(selectId) = new Option(selectedTypes[trendCategory][i],selectedTypes[trendCategory][i],false);
There are some ways to do what you want. For example:
Code:JavaScript Code: var myArray = { value1: "hello", value2: "what's up", value3: "not much"} for (var i in myArray) { alert(test[i]); }
TRY THIS :
Code:eval("eval('object'+id+' = new GLatLng(x,y)');"); and three evals too: eval("eval(\"eval('object'+id+' = new GLatLng(x,y)');\")"); but you don need eval in your case. you need check the variable if(object1) { //do something with it }
Bookmarks