asp动态树菜单集合(1/3)

二级树菜单,可以同时打开多个子菜单

如下类型

asp动态树菜单集合(1/3)

数据库结构如下:

为了方便全部程序的调试,有多余字段,使用时请删除多余字段.

bigclass表

bigclassid bigclassname

smallclass表

smallclassname,smallclassid,bigclassid,bigclassname

< ! -- #includefile = " inc/conn.asp " -->
< tableborder = " 0 " width = " 100% " height = " 200 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< tdwidth = " 20% " height = " 200 " bgcolor = " #F0F0F0 " valign = top >
< scriptlanguage = " JavaScript " >
< ! --
FunctionshowLay() functionshowLay(divId){
varobjDiv
=eval(divId);
if(objDiv.style.display=="none"){
eval(
"sp"+divId+".innerHTML='-'");
objDiv.style.display
="";
}
else{
eval(
"sp"+divId+".innerHTML='+'");
objDiv.style.display
="none";
}
}
//-->
</script>
<%
dimrsTEMP,sqlTEMP
bigclassname
=request("bigclassname")
smallclassname
=request("smallclassname")

callopenDB()
sql
="selectbigclassid,bigclassnamefrombigclass"
setrs=conn.execute(sql)
counter
=0'---------------------------------------------------------------------ACOUNTERUSED
whilenotrs.eof
counter
=counter+1
sqlTEMP
="selectsmallclassnamefromsmallclasswherebigclassid="&rs("bigclassid")
setrsTEMP=conn.execute(sqlTEMP)
ifbigclassname<>rs("bigclassname")then
%
>
<ahref="#"onclick="showLay('Layer<%=counter%>')"><spanid="spLayer<%=counter%>">+</span><%=rs("bigclassname")%></a><br>
<divid="Layer<%=counter%>"style="display:none;">
<%whilenotrsTEMP.eof%>
|
-<aHREF="bookincategory.asp?bigclassname=<%=rs("bigclassname")%>&smallclassname=<%=rsTEMP("smallclassname")%>">
<%=rsTEMP("smallclassname")%></a><br>
<%
rsTEMP.movenext
wend
else
%
>
<ahref="#"onclick="showLay('Layer<%=counter%>')"><spanid="spLayer<%=counter%>">-</span><%=rs("bigclassname")%></a><br>
<divid="Layer<%=counter%>">
<%whilenotrsTEMP.eof%>
|
-<aHREF="bookincategory.asp?bigclassname=<%=rs("bigclassname")%>&smallclassname=<%=rsTEMP("smallclassname")%>">
<%=rsTEMP("smallclassname")%></a><br>
<%
rsTEMP.movenext
wend
endif
%
>
</div>
<%
rs.movenext
wend
%
>
</td>
<tdwidth="80%"height="200"bgcolor="#F7FDFD">

</td></tr></table>











你可能感兴趣的:(JavaScript,数据结构,sql,asp)