Home > Web Front-end > JS Tutorial > Implementation of three-level linkage in js

Implementation of three-level linkage in js

巴扎黑
Release: 2016-11-25 10:50:43
Original
1174 people have browsed it

The implementation of linkage is actually very simple, but some details are easy to make mistakes. Here I would like to share my basic ideas for realizing third-level linkage after learning the second-level linkage.
Idea: Because the second-level linkage is the connection between the first-level linkage and the second-level linkage through the onchange event, the third-level linkage is the connection between the second-level linkage and the third-level linkage. (Maybe the expression is not clear enough) To put it simply, the process is roughly: A event - trigger - B event - trigger - C event.
​ Note: Pay special attention to the matching of the subscript corresponding to the array and the option value. The value of each option in the option option can also be a number. It is more convenient to implement the value with a number.
Example questions:                                                                                                                                                                                                                    First semester—>HTML, Java, SqlServer basics ,C#
First academic year—>Second semester—>javascript,.Net,SqlServer Advanced,JSP
Second academic year—>First semester—>Struts,ASP.NET,Ajax
Second academic year—> The second semester -& gt; spring, hibernate '


code:
java code

& lt;! Doctype html & gt;

& lt; html lang = "en" & lt; & & gt;

& lt; m ETA charset="UTF-8"> Courses

Academic year < select id='year' onchange='change1(this)'>                                                                                                                        < The first school year & lt;/option & gt;

& lt; option value = 'The second school year' & gt; GE2 (this) function to realize the linkage between semester and course-->

semester