Province: |
Select Shandong |
City: |
= Select =Weihai CityDezhou CityBinzhou City |
Districts and counties: |
= Select Villages and Towns =WeihaiWendengRongchengRushan |
Province, city, and district/county Data Structure: [name, parent class ID, current ID]
OnChange = "changelocation2 (document. editForm. smalllocation. options [document. editForm. smalllocation. selectedIndex]. value )"
Obtain the parent class ID of the next level association menu based on selectedIndex,
Copy codeThe Code is as follows:
Function changelocation (locationid)
{
Document. editForm. smalllocation. length = 0;
// Document. editForm. dlmc0.length = 0;
Document. getElementById ("dlmc0"). length = 0;
// Document. editForm. dlmc0.options [0] = new Option ('= select = ','');
Document. getElementById ("dlmc0"). options [0] = new Option ('= select = ','');
// Alert (locationid );
Var locationid = locationid;
Var I;
Document. editForm. smalllocation. options [0] = new Option ('= select = ','');
For (I = 0; I <onecount; I ++)
{
If (subcat [I] [1] = locationid)
{
Document. editForm. smalllocation. options [document. editForm. smalllocation. length] = new Option (subcat [I] [0], subcat [I] [2]);
}
}
}