zoukankan      html  css  js  c++  java
  • asp:树型select菜单


    调用处

    <%
    Dim rss,u
    Set rss = Server.CreateObject("Adodb.RecordSet")
    rss.Open 
    "select ID,ParentID,SortName from [Sorts] order by ParentID",Conn,1,1
    Response.Write 
    "<select onChange=""MM_jumpMenu('this',this,0)"">"&GetListTree&"<select>"
    rss.Close
    %
    >
    产生菜单的函数。
    Function GetListTree
        
    Dim Result,i
        
    Redim u(rss.RecordCount,3)
        
    for i = 1 to rss.RecordCount
            u(i 
    - 1,0= rss("ID")
            u(i 
    - 1,1= rss("ParentID")
            u(i 
    - 1,2= rss("SortName")
            rss.MoveNext
        
    next
        
    'rss.moveFirst
        for i = 0 to uBound(u) - 1
            
    If Int(u(i,1)) = 0 Then
                Result 
    = Result &"<option value='?SortID="& u(i,0&"&ParentID="& ParentID &"'>◢"& u (i ,2&"</option>"& vbcrlf & SunSorts(u(i ,0), 0)
            
    End If
        
    next
        GetListTree 
    = Result
    End Function

    Function SunSorts(who,SunLevel)
            
    Dim selected
            
    Dim Result,i,sp,EndID
            
    for i = 0 to SunLevel
                sp 
    = sp &"--"
            
    next
            
    for i = 0 to uBound(u) - 1
                
    If Int(u(i,1)) = Int(who) Then
                    EndID 
    = u(i ,0)
                
    End If
            
    next
            
    for i = 0 to uBound(u) - 1
                
    If Int(u(i,1)) = Int(who) Then
                    
    If u(i ,0- EndID = 0 Then
                        Result 
    = Result &"<option "&selected&" value='?SortID="& u(i,0&"&ParentID="&ParentID&"'>"& sp &""& u(i ,2& "</option>"& vbcrlf & SunSorts(u(i ,0),SunLevel + 1)
                    
    Else
                        Result 
    = Result &"<option "&selected&" value='?SortID="& u(i,0&"&ParentID="&ParentID&"'>"& sp &""& u(i ,2& "</option>"& vbcrlf & SunSorts(u(i ,0),SunLevel + 1)
                    
    End If
                
    End If
            
    next
            SunSorts 
    = Result
    End Function


     

    效果

  • 相关阅读:
    面试准备(集合部分)
    面试准备(算法部分)
    面试准备(sql部分 索引、常用语句 、)
    破解idea软件教程
    40个Java多线程问题详解复习
    面向对象(2)
    开发中容易造成内存泄露的操作
    面向对象(1)
    vue-cli中找不到jquery的原因,以使用ztree为例
    Django中整合Vue-cli,并解决各种路径引用错误和跨域的问题
  • 原文地址:https://www.cnblogs.com/zkxp/p/383702.html
Copyright © 2011-2022 走看看