树形菜单:
<SCRIPT language="JavaScript">
var lastObj
function expandIt(obj)
{
if(lastObj != null)
{
if(obj == lastObj)
{
if(obj.style.display == "none")
{
obj.style.display = "";
}
else
{
obj.style.display = "none"
}
}
else
{
lastObj.style.display = "none";
obj.style.display = "";
}
}
else
{
obj.style.display = "";
}
lastObj = obj
}
</SCRIPT>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
dim id
id = request("id")
dim strsql,rs
strsql="select * from p_type where slanguage=1 and typelevel=1 order by typename"
set rs=fgetrslist(strsql)
do while not rs.eof
%>
<tr>
<td height="25" class="LEFTLINKS"><img width="30" height="0" align="absmiddle" /><b><%if rs("isleaf")=0 then%><a href="#" onClick="javascript:expandIt(kb<%=rs("id")%>);return false"><%else%><a href="<%=request.ServerVariables("SCRIPT_NAME")%>?idtree=<%=rs("idtree")%>" ><%end if%><%=server.HTMLEncode(right((rs("typename")&""),len(rs("typename")&"")-2))%></a></b></td>
</tr>
<%
IF clng(id)=clng(rs("id")) then
%>
<tr id="kb<%=rs("id")%>">
<%
else
%>
<tr id="kb<%=rs("id")%>" style="display:none;">
<%
end if
%>
<td>
<table>
<%
dim rs1
strsql="select * from p_type where parentid="&rs("id")&" and slanguage=1 order by typename"
set rs1=fgetrslist(strsql)
do while not rs1.eof
%>
<tr><td height="20" class="LEFTLINKS">
<img width="40" height="0" align="absmiddle" /><a href="<%=request.ServerVariables("SCRIPT_NAME")%>?idtree=<%=rs1("idtree")%>&id=<%=rs("id")%>" ><%=server.HTMLEncode(right((rs1("typename")&""),len(rs1("typename")&"")-2))%></a></td></tr>
<%
rs1.movenext
loop
rs1.close
set rs1=nothing
%>
</table>
</td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>