或者
<%
function menu(menuid)
set rs= Server.CreateObject("adodb.recordset")
sqlstr="select * from menutab where id="&menuid
rs.open sqlstr,conn,1,1
temp=""
if rs.eof then
rs.close
set rs=nothing
menu=temp
else
if rs("menuParentID")=0 then temp=rs("menuName") else temp= temp&">>"&rs("menuName")
parent = menu(Rs("menuParentID"))
temp= parent&temp
End If
menu=temp
end function
%>
<%= menu(5) %>
<%
function menu(menuid)
set rs= Server.CreateObject("adodb.recordset")
sqlstr="select * from menutab where id="&menuid
rs.open sqlstr,conn,1,1
temp=""
if rs.eof then
rs.close
set rs=nothing
menu=temp
else
if rs("menulevel")=1 then temp=rs("menuName") else temp= temp&">>"&rs("menuName")
parent = menu(Rs("menuParentID"))
temp= parent&temp
End If
menu=temp
end function
%>
<%= menu(5) %>