The article provides a JS two-level Linkage Drop-down List menu Effect Oh, this is a city linkage menu effect, if you are the JS linkage menu, you can come in and see, this is the use of an array to save all the city, and then select the Drop-down box to put the city, each two-dimensional array is a pair of cities.
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title> New Document </title>
<script language= "Web Effects" type= "Text/javascript" >
<!--
Define a two-dimensional array in the order of the Province Drop-down list box to correspond the city list to the province
var city=[
["Beijing", "Tianjin", "Shanghai", "Chongqing"],//municipality
["Nanjing", "Suzhou", "Nantong", "Changzhou"],//Jiangsu province
["Fuzhou", "Fu'an", "Longyan", "nanping"],//Fujian province
["Guangzhou", "Chaoyang", "Chaozhou", "Chenghai"],//Guangdong province
["Lanzhou", "Silver", "Dingxi", "Dunhuang"]//Gansu Province
];
Function getcity () {
//obtains a reference to the body province and city drop-down list box
var sltprovince=document.forms[theform "].elements[" Province "];
var sltcity=document.forms["theform"].elements["City"];
//Gets the list of cities that correspond to the provinces
var provincecity=city[sltprovince.selectedindex-1];
// Empty the City Drop-down list box, leaving only the first hint option
sltcity.length=1
//the city to the city selection box
for (Var i=0;i< provincecity.length;i++) {
//creates a new option object and adds it to the City drop-down list box
sltcity[i+1]=new option ( Provincecity[i],provincecity[i]);
}
}
//-->
</script>
<body>
<form action= "somepage.asp tutorial" name= "theform"
<select name= "province" onchange= "Getcity ()"
<option value= "0" > Please select the province </option>
<option value= "municipality" > municipality </option>
<option value= "Jiangsu province" > Jiangsu province </option>
<option value= "Fujian province" > Fujian province </option>
<option value= "Guangdong province" > Guangdong province </option>
<option value= "Gansu province" > Gansu province </option>
< /select>
<select name= "City"
<option value= "0" > Please choose your town </option>
</select
</form>
</body>