We think that most network programmers will encounter, this situation refers to a page with two or more drop-down list boxes in one page, and the value of the second list box The value of the first list box changes (ie, the unnecessary data is filtered), for example, when the user registration information, when the user selects the province, the city name of the province appears in the second drop-down list box.
There are two solutions to this situation. One is to implement using the network programming language used (such as ASP, JSP, PHP, etc.), but the disadvantage of this method is that when the user is very slow, the speed is very Slow, the value of the second drop-down list is taken for a while, reducing efficiency, and the page is not good, this method is not described here.
The second solution is to use JavaScript to control, its basic idea is: first store the names and encodings of all cities and the codes of the provinces to be stored in one two array, the array has three columns, the number of rows according to the city The number decision, each line of the first column represents the city number, the second column represents the city name, the third column represents the number of the province. The data structure is like a table in the database, just there is no field name here.