I compared B. I didn't know how to use video to solve the problem. I had to use this confusing word to write it.
In general, this situation is useful for second-level directories. There are many types of JS codes circulating on websites, but they are nothing more than those JS codes that make Cainiao like me dizzy .. All at once for... all at once array.
Let's just talk about it.
First, you have to create a table. Of course, if you have already created a directory in your table, this step can be omitted. But one thing to note is that this table is the basis for my example (I don't know if this is true or not ).
Since the table I used is ACCESS, I will not talk about table creation. I will only list the corresponding field names of the two tables (database name: db. mdb ):
Table name: type_tree -- parent class
Field: type_id (automatic number) type_name (category name)
Table name: s_type -- subclass
Field: id (automatic number) s_name (sub-category name) type_id (parent class ID) -- corresponds to the parent class table
Create a database connection:
Dim conn, connStrSet conn = server. createObject ("ADODB. connection ") connStr =" Provider = Microsoft. jet. oledb.4.0; "connStr = connStr &" Data Source = "& server. mappath ("db. mdb ") Conn. open connStr
The above code should not be explained. It is common code ..
Now proceed to substantive operations :)
In general, the list-level association menu is based on the following pull menu. Here I am no exception. The same applies to the drop-down menu.
But there is a difference here.
A jump menu is used, which is very important. Whether the menu is successful or not depends on whether it is used correctly!
Below is the code for this jump menu!
<Select name = "first" onChange = "MM_jumpMenu ('parent', this, 0)">
<%
SQL = "select [type_id], [type_name] from [type_tree]"
Set rs = conn.exe cute (SQL) 'get the ID and name of the parent class
If rs. eof or rs. bof then
Response. write "<option> ----- </option>" 'If No record exists -----
Else
While not (rs. eof or rs. bof) 'has Records, and the parent name is listed to form a drop-down list.
Response. write ("<option value = '? Sec = "& rs (0 )&"'")
If cstr (rs (0) = request. querystring ("sec") then
Response. write "selected"
End if
Response. write (">" & rs (1) & "</option> ")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service