Bind the SELECT drop-down menu by declaring 2D array
HEAD>
// Define a two-dimensional array AARRAY to store the city name. VAR ACITY = New Array (); ACITY [0] = New Array (); ACITY [1] = new array (); ACITY [2] = new array (); acid [3] = new array (); // Assignment, the city in each province stores in one line of array. ACITY [0] = "- Please select -"; ACITY [1] [0] = "- Please select -"; ACITY [1] [1] = "Guangzhou"; ACITY [1 ] [2] = "Shenzhen"; ACITY [1] [3] = "Zhuhai"; ACITY [1] [4] = "Shantou"; ACITY [1] [5] = "Foshan"; ACITY [2] [0] = "- Please select -"; ACITY [2] [1] = "Changsha"; ACITY [2] [2] = "Zhuzhou"; ATITY [2] [3] = "Xiangtan City"; ACITY [3] [0] = "- Please select -"; ACITY [3] [1] = "Hangzhou"; ACITY [3] [2] = "Suzhou"; ACITY [3] [3] = "Wenzhou"; function ChangeCity () {var i, iProvinceIndex; iProvinceIndex = document.frm.optProvince.selectedIndex; iCityCount = 0; while (! aCity [iProvinceIndex] [iCityCount] = null) iCityCount ; // Calculate the number of urban documents for the selected province Document.Frm.optcity.Length = ICITYCOUNT; / / change the number of options for the drop-down menu (i = 0; i <= icrycount-1; i ) // change the drop-down menu Content document.frm.optcity [i] = new option (ACITY [iProvinceIndex] [i]); document.frm.optcity.focus ();
Script>