ajax+asp无限级分类树型结构(带数据库)(6)


function GetId(id)
{
return document.getElementById(id);
}
</script>
</head>
<body>
<!--#include file="../conn.asp"-->
<%
'显示根目录
sql="select *,(select top 1 ClassID from ArticleClass where Depth=0 order by ClassID desc) as lastid from ArticleClass where Depth=0 order by ClassID"
set rs=conn.execute(sql)
if not rs.eof then
response.Write "<ul>"&vbcr
do while not rs.eof
if cint(trim(rs("ClassID")))=cint(trim(rs("lastid"))) then
if rs("Child")>0 then
response.Write "<li><img id='p"&rs("ClassID")&"' src=""images/lastclosed.gif"" onclick=""DivDisplay2('c"&rs("ClassID")&"','"&rs("ClassID")&"','p"&rs("ClassID")&"','f"& rs("ClassID") &"')"" style=""cursor : hand;"" align=""absmiddle"">"
response.Write "<img src=""images/folder.gif"" align=""absmiddle"" id='f"& rs("ClassID") &"' /> <span id='s"& trim(rs("ClassID")) &"' onclick=""BrowseRight("& trim(rs("ClassID")) &")"" ondblclick=""DivDisplay2('c"&rs("ClassID")&"','"&rs("ClassID")&"','p"&rs("ClassID")&"','f"& rs("ClassID") &"')"">"& rs("ClassName") &"</span>"
else
response.Write "<li><img id='p"& rs("ClassID") &"' src=""images/lastnochild.gif"" align=""absmiddle"" />"
response.Write "<img src=""images/folder.gif"" align=""absmiddle"" id='f"& rs("ClassID") &"' /> <span id='s"& trim(rs("ClassID")) &"' onclick=""BrowseRight("& trim(rs("ClassID")) &")"">"& rs("ClassName") &"</span>"
end if
else
if rs("Child")>0 then
response.Write "<li><img id='p"&rs("ClassID")&"' src=""images/closed.gif"" onclick=""DivDisplay('c"&rs("ClassID")&"','"&rs("ClassID")&"','p"&rs("ClassID")&"','f"& rs("ClassID") &"')"" style=""cursor : hand;"" align=""absmiddle"">"
response.Write "<img src=""images/folder.gif"" align=""absmiddle"" id='f"& rs("ClassID") &"' /> <span id='s"& trim(rs("ClassID")) &"' onclick=""BrowseRight("& trim(rs("ClassID")) &")"" ondblclick=""DivDisplay('c"&rs("ClassID")&"','"&rs("ClassID")&"','p"&rs("ClassID")&"','f"& rs("ClassID") &"')"">"& rs("ClassName") &"</span>"
else
response.Write "<li><img id='p"& rs("ClassID") &"' src=""images/nofollow2.gif"" align=""absmiddle"" />"
response.Write "<img src=""images/folder.gif"" align=""absmiddle"" id='f"& rs("ClassID") &"' /> <span id='s"& trim(rs("ClassID")) &"' onclick=""BrowseRight("& trim(rs("ClassID")) &")"">"& rs("ClassName") &"</span>"
end if
end if
if cint(trim(rs("ClassID")))=cint(trim(rs("lastid"))) then
response.Write "<div id='c"&rs("ClassID")&"' style='display:none;'></div>"
else
response.Write "<div id='c"&rs("ClassID")&"' style='display:none;' class=""childdiv""></div>"
end if
response.Write "</li>"&vbcr
rs.movenext
loop
response.Write "</ul>"&vbcr
end if
rs.close
set rs=nothing
conn.close
Set conn = Nothing
%>
</body>
</html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1996.html