This article mainly introduces the implementation of simple level-2 interaction in javascript, which is very practical. If you need it, you can refer to the following level-2 Association, which can be seen everywhere on general webpages. It is generally an address, such as clicking on Zhejiang Province, the city of Hangzhou, Jiaxing city, followed by Chaoyang and Haidian in Beijing, rather than Hangzhou and Jiaxing.
To implement this step, javascript is required. The onchange time is used as the principle.
First, the onchange event occurs when the content of the domain changes. JavaScript objects that support this event: fileUpload, select, text, and textarea. select is used for implementation of level-2 interaction.
The following is the HTML code. First, set a select statement to province and the second select statement to city. However, we use arrays in js to connect the select statement to province.
The Code is as follows:
Javascript second-level interaction
Save Beijing Zhejiang