ASP Multilevel Linkage Menu
<!--#include file= "adoconn.asp"-->
<%
Dim xmldoc, Parentcode, code
' Dim root as IXMLDOMElement
' Dim Newelem as IXMLDOMElement
Response. ContentType = "text/xml" ' Output format is XML
Parentcode = Request ("Parentcode")
If Parentcode = "" Then
Response.Write "<Tree/>"
Response.End
End If
Set Xmldoc=createobject ("Microsoft.XMLDOM") ' New Xmldom object
Xmldoc.loadxml ("<tree treeid=" "Materialclass_" &ParentCode& "" "nodexmlsrc=" "tree.asp"? Parentcode= "&ParentCode&" "/>")
If Parentcode = "Then"
Code = "__"
Else
Code = parentcode & "__"
End If
Set root = xmldoc.documentelement
Set Rs=server.createobject ("Adodb.recordset")
Strsql= "Select y_id, Y_code, [Y_title] from M_style where Y_code like '" &code& ""
Rs. Open strsql,conn,1,1
If not rs.eof Then
Do as not rs.eof
Set Newelem = xmldoc.createelement ("TreeNode")
Root.appendchild Newelem
Newelem.setattribute "NodeId", "Materialclass_" & RS ("Y_code")
Newelem.setattribute "Title", RS ("Y_title")
If Len (rs ("Y_code")) <6 Then Newelem.setattribute "Nodexmlsrc", "tree.asp?" Parentcode= "& RS (" Y_code ")
Newelem.setattribute "Href", RS ("Y_code")
Newelem.setattribute "Materialclasscode", RS ("Y_code")
Rs.movenext
Loop
End If
Rs.close
Set rs = Nothing
Response.Write ("<?xml version=" "1.0" "encoding=" "GB2312" "?>" &xmldoc.xml)
%>
Here is primarily to use asp to generate XML documents and then use Microsoft.XMLDOM read xml to the JS classification, in addition to the point can be directly in the JS code asp The code allows it to generate JS code, which is also a multi-level linkage menu processing method