There are many third-level menus online, but the code is annoying. I should say that this is quite intuitive:
'It's definitely necessary to connect to the database first, needless to say
'Database structure
'Category 1 table name: a field: ID, Name Description: ID is the primary key and is the ID value of category 1, Name is the name of category 1
'Category 2 table name: aa field: ID, aID, Name Description: ID is the primary key and is the ID value of category 2, aID is the ID value of category 1, and Name is the name of category 2
'Category 3 table name: aaa field: ID, aID, aaID, Name Description: ID is the primary key and is the ID value of category 3, aID is the ID value of category 1, aaID is the ID value of category 2, and Name is the name of category 3
======test1.asp You can test it. All the received ID values of the category====
<%
response.write"1:"&Request.form("s1")&"<BR>"
response.write"2:"&Request.form("s2")&"<BR>"
response.write"3:"&Request.form("s3")&"<BR>"
%>
The code copy is as follows:
<!--The three-level linkage menu start-->
<scriptlanguage="JavaScript">
<!--
<%
'Save secondary data to array
Dimcount2,rsClass2,sqlClass2
setrsClass2=server.createobject("adodb.recordset")
sqlClass2="select*froma"
rsClass2.opensqlClass2,conn,1,1
%>
varsubval2=newArray();
//Array structure: first-level root value, second-level root value, second-level display value
<%
count2=0
dowhilenotrsClass2.eof
%>
subval2[<%=count2%>]=newArray('<%=rsClass2("aID")%>','<%=rsClass2("ID")%>','<%=rsClass2("Name")%>')
<%
count2=count2+1
rsClass2.movenext
loop
rsClass2.close
%>
<%
'Save three-level data to array
Dimcount3,rsClass3,sqlClass3
setrsClass3=server.createobject("adodb.recordset")
sqlClass3="select*fromaa"
rsClass3.opensqlClass3,conn,1,1
%>
varsubval3=newArray();
//Array structure: second-level root value, third-level root value, third-level display value
<%
count3=0
dowhilenotrsClass3.eof
%>
subval3[<%=count3%>]=newArray('<%=rsClass3("aaID")%>','<%=rsClass3("ID")%>','<%=rsClass3("Name")%>')
<%
count3=count3+1
rsClass3.movenext
loop
rsClass3.close
%>
functionchangeselect1(locationid)
{
document.form1.s2.length=0;
document.form1.s2.options[0]=newOption('==Please select category==','');
document.form1.s3.length=0;
document.form1.s3.options[0]=newOption('==Please select topic==','');
for(i=0;i<subval2.length;i++)
{
if(subval2[i][0]==locationid)