var ArrCitie=new Array(); var ArrCityId=new Array(); var ArrStates=new Array(); ArrStates[0]='17';ArrCityId[0]='10';ArrCitie[0]='fff';ArrStates[1]='17';ArrCityId[1]='8';ArrCitie[1]='nick_name';ArrStates[2]='17';ArrCityId[2]='9';ArrCitie[2]='uu'; function swapOptionsCitys(theForm,thecityId,theSubSelect) { theSubSelect.options.length=0; theSubSelect.disabled = false; var counter=0; theSubSelect.options[counter] = new Option('Select landing_pg',''); for (var loop=0; loop < ArrCities.length; loop++) { if(ArrStates[loop]==thecityId) { theSubSelect.options[counter+1] = new Option(ArrCitie[loop], ArrCityId[loop]); counter++; } } }