Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop Through Array

Status
Not open for further replies.

Moonpie10

Programmer
Joined
Feb 22, 2005
Messages
14
Location
US
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>
 
Give us the output of the ASP, not the ASP code itself.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top