2013年10月11日 星期五

asp-gen-popdown menu (horizontal)


<%
response.expires=-1
Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
OBJdbConnection.Open "DSN=menu;UID=userId;PWD=UserPassword;Database=users"
Set SQLStmt = Server.CreateObject("ADODB.Command")
Set RS = Server.CreateObject ("ADODB.Recordset")
mCompany="FGI"
'SQLStmt.CommandText = "select REPORTNAME,division,company from menu where COMPANY='" & mCompany &"'"
sql="select * from menu where company='' and division=''  union select * from menu "
SQLStmt.CommandText = sql
SQLStmt.CommandType = 1
Set SQLStmt.ActiveConnection = OBJdbConnection
RS.Open SQLStmt
nextlevel2=""
nextlevel3=""
nextlevel3close=""
nextlevel4close=""
level1=""
level2=""
level3=""
Do While Not RS.EOF
O=RS("mainreportlevel")
T=RS("subreportlevel")
W=RS("Thirdreportlevel")
S=RS("REPORTNAME")
D=RS("DIVISION")
C=RS("COMPANY")
L=RS("LINK")
If o <> level1 then
Response.Write(nextlevel4close)
nextlevel4close=""
Response.Write(nextlevel3close)
nextlevel3close=""
Response.Write(nextlevel2)
Response.Write("<li><a href='#' class='MenuBarItemSubmenu'>"+o+"</a>")
Response.Write("<ul>")
end if
If t <> level2 then
Response.Write(nextlevel4close)
nextlevel4close=""
Response.Write(nextlevel3close)
nextlevel3close=""
Response.Write("<li style='width:160px'><a href='#'>"&T&"(2)</a>")
nextlevel3="<ul>"
end if
If w&t <> level3 then
Response.Write(nextlevel4close)
nextlevel4close=""
Response.Write(nextlevel3)
nextlevel3=""
Response.Write("<li style='width:160px'><a href='#'>"&W&"(3)</a>")
nextlevel3close="</ul>"
Response.Write("<ul>")
nextlevel4close="</ul>"
end if
Response.Write("<li style='width:160px'><a href='#'>"&S&"(4)</a>")
If w <> level3 then
level3=W&t
end if
If t <> level2 then
Response.Write("</li>")
level2=T
end if
If o <> level1 then
nextlevel2="</ul>"
Response.Write("</li>")
level1=o
end if
RS.MoveNext
LOOP
%>  

沒有留言:

張貼留言