yms123,按照上面的帖子写出来,还是没有达到预期的效果。
请你帮忙指点下面代码该如何写折叠效果的JS。
<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>目录列表</title>
<link href="images/CSSclass.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
Dim sqlstr,rs,name,ename,subname,subename
sqlstr="select * from class where layer=1 order by paixuhao,id asc"
set rs=server.CreateObject("adodb.recordset")
rs.open sqlstr,connstr,1,1
if not rs.eof then
response.Write("<table border=""0"" bgcolor=""#6E92DB"" cellpadding=""0"" cellspacing=""1"">")
while not rs.eof
name=rs("name")
ename=rs("ename")
if ename <> "" then
ename="["& ename &"]"
end if
response.Write "<tr><td height=""25"" bgcolor=""#ffffff"">" & name & ename & "</td>" '一级菜单显示
subid=rs("id")
call subclass(subid)
rs.movenext
wend
response.Write("</table>")
else
response.Write("< table border=""0"" bgcolor=""#ffffff"" cellpadding=""0"" cellspacing=""1"" ><tr><td height=""25"" bgcolor=""#6E92DB"">没有记录</td></tr></table>")
end if
sub subclass(id)
sqlstr1="select * from class where classid=" & id & " order by paixuhao,id asc"
set rs1=server.CreateObject("adodb.recordset")
rs1.open sqlstr1,connstr,1,1
if not rs1.eof then
while not rs1.eof
layernum=rs1("layer")
subname=rs1("name")
subename=rs1("ename")
if subename <> "" then
subename="["&subename&"]"
end if
response.Write "<tr><td height=""25"" bgcolor=""#ffffff"">" & spance(layernum) &""& subname & subename & "</td>" '二级菜单显示
subid1=rs1("id")
call subclass(subid1)
rs1.movenext
wend
end if
rs1.close
set rs1=nothing
end sub
function spance(k)
sp=""
spce=""
for i=1 to k-1
spce=spce & sp
next
spance=spce
end function
%>
</body>
</html>