ASP Multilevel Linkage Menu two

Source: Internet
Author: User

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

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.