ok. i have several custom objects. These objects are filled with arrays.
I have a drop down with choices. I want to be able to get an object by its name, using a variable based on the dropdown choice.
as for the object, as the title says, i am speaking about a new object created by myself. I have searched high and low unsuccessfully, so far as i can tell, to get the variable to locate this object. sample code is as follows.
myobject1 = {
property1 : ['arr1', 'arr2', 'arr3'],
property2 : ['arr1', 'arr2', 'arr3'],
property3 : ['arr1', 'arr2', 'arr3']
}
myobject2 = {
property1 : ['arr1', 'arr2', 'arr3'],
property2 : ['arr1', 'arr2', 'arr3'],
property3 : ['arr1', 'arr2', 'arr3']
}
function getmyobject(){
var1 = mydd.value; //contains 'myobject1'
//code to strip and filter out non-alphanumerics and spaces, also to lcase
var2 = window.var1;
for (conditions to loop){
//code to make the loop spit out i for each array inside of object
}
it returns an undefined unless i replace window.var1 with window.objname where objname is the actual name of the object, thus defeating the dynamicism of the whole thing.
Use
window[var1](I guess var1 is a string).