Hi,
I am trying to loop through an array where it meets the criteria in a selection from a list box and then output to another select box, but I keep getting an 'undefined' is null or not an object error. I can't seem to find the reason for this error. Can someone look at my script and see what I am missing?
Thanks!
<script language="javascript">
Africa='<%=terrString%>';
AsiaPacific='<%=terrString%>';
Canada='<%=terrString%>';
Europe='<%=terrString%>';
LatinAmerica='<%=terrString%>';
MiddleEast='<%=terrString%>';
UnitedStates='<%=stateString%>';
Region='<%=dbList%>';
function PopulateSelect2(obj1,id2,selectedOptions){
if (obj1.selectedIndex<0){ return; }
obj2=document.getElementById(id2)
obj2.options.length=0;
obj3 = document.getElementById("selectedOptions");
obj3.options.length=0;
ThisString=obj1.options[obj1.selectedIndex].value;
ThisString=eval(ThisString);
for (i=0;i<ThisString.split('<').length-1;i++){
obj2.options=new Option(ThisString.split('<')[i+1].split('>')[1],ThisString.split('<')[i+1].split('>')[0],true,true);
}
obj2.selectedIndex=0;
for(var j=0;j<Region.length;j++)
{
var temp = Region[j];
var arrTemp = temp.toString().split(',');
if(arrTemp[0] == obj1.options[obj1.selectedIndex].value)
{
var newOption = new Option(arrTemp[1], arrTemp[1]);
obj3.options[obj3.length] = newOption;
}
}
}
</script>
I am trying to loop through an array where it meets the criteria in a selection from a list box and then output to another select box, but I keep getting an 'undefined' is null or not an object error. I can't seem to find the reason for this error. Can someone look at my script and see what I am missing?
Thanks!
<script language="javascript">
Africa='<%=terrString%>';
AsiaPacific='<%=terrString%>';
Canada='<%=terrString%>';
Europe='<%=terrString%>';
LatinAmerica='<%=terrString%>';
MiddleEast='<%=terrString%>';
UnitedStates='<%=stateString%>';
Region='<%=dbList%>';
function PopulateSelect2(obj1,id2,selectedOptions){
if (obj1.selectedIndex<0){ return; }
obj2=document.getElementById(id2)
obj2.options.length=0;
obj3 = document.getElementById("selectedOptions");
obj3.options.length=0;
ThisString=obj1.options[obj1.selectedIndex].value;
ThisString=eval(ThisString);
for (i=0;i<ThisString.split('<').length-1;i++){
obj2.options=new Option(ThisString.split('<')[i+1].split('>')[1],ThisString.split('<')[i+1].split('>')[0],true,true);
}
obj2.selectedIndex=0;
for(var j=0;j<Region.length;j++)
{
var temp = Region[j];
var arrTemp = temp.toString().split(',');
if(arrTemp[0] == obj1.options[obj1.selectedIndex].value)
{
var newOption = new Option(arrTemp[1], arrTemp[1]);
obj3.options[obj3.length] = newOption;
}
}
}
</script>