A strong and practical Ajax secondary linkage menu (with demonstration and source program package download)
A few days ago, when I was working on the backend, I used the second-level linkage menu. I searched online for a long time but couldn't find anything satisfactory. It was either this or that. Sometimes I couldn't return when making a choice. I was really depressed.
Later I saw someone using ajax to write an infinite-level classification (ao, haha, I can't understand it). I thought that I could try using ajax in the background. Although it was slower than using javascript, my this is practical and powerful. I will not make any mistakes, nor will I choose a major category and then return to the state where the subclass is empty without selection. Haha.
File directory: as shown in the picture
The main code is as follows:
index.asp
The code copy is as follows:
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"c/>
<title>Ajax's second-level linkage by Ah Feng</title>
<scriptlanguage="javascript"src="js.js"></script>
</head>
<body>
<h2><ahref="http://yeahdown.com/">Ajax's second-level linkage by Ahfeng</a></h2>
<!--#includefile="iconn.asp"-->
<%
Setafeng=Conn.Execute("selectbigclassid,bigclassnamefrombigclass")
%>
<formid="form1"name="form1"method="post"action="">
<divid="bigclass"style="float:left">
<selectname="select">
<optionvalue="0">Select first-level classification</option>
<%IfNotafeng.Eofthen
DoWhileNotafeng.Eof
bigclassid=afeng("bigclassid")
bigclassname=afeng("bigclassname")%>
<optionvalue="<%=bigclassid%>"><%=bigclassname%></option>
<%afeng.Movenext
Loop
EndIf
afeng.Close
Setafeng=Nothing
Conn.Close
SetConn=Nothing%>
</select>
</div>
<divid="subclass"style="float:left"><selectname="select2">
<optionvalue="0">Select secondary classification</option>