动态树菜单,可以选择打开父菜单或者是打开子菜单.

以下是最的一个动态树行菜单,子菜单可以打开多个.子菜单没有项目时候父菜单仍然可以使用.在有
子菜单时候父菜单仍然可以打开


< tablewidth = " 100% " border = " 0 " cellpadding = " 0 " cellspacing = " 0 " align = " center " >

< %
set rsBigClass1 = server.CreateObject( " adodb.recordset " )
rsBigClass1.open
" Select*Frombigclass " ,conn, 1 , 1
i
= 0
do while not rsBigClass1.eof
i
= i + 1
%
>
< trvalign = " top " >
< tdwidth = " 90% " >& nbsp; & nbsp; < ahref = " Product.asp?bigclassname=<%=rsBigClass1( " bigclassname " )%> " class = " my1 " >< % = rsBigClass1( " bigclassname " )% ></ a >
< script >
function showtable < % = " a " & i% > ()
{
if (document.all( " <%= " a " &i%> " ).style.display == " none " )
{document.all(
" <%= " a " &i%> " ).style.display = "" ;}
else
{document.all(
" <%= " a " &i%> " ).style.display = " none " ;}
}
</ script >
</ Td >< Tdvalign = " middle " >< ahref = " # " onClick = " javascript:showtable<%= " a " &i%>(); " >< % set rscheck = server.CreateObject( " adodb.recordset " )
rscheck.open
" Select*FromsmallclassWherebigclassname=' " & rsBigClass1( " bigclassname " ) & " ' " ,conn, 1 , 1
if not (rscheck.bof and rscheck.eof) then % >< imgsrc = images / nvdown.jpgborder = " 0 " >< % end if % ></ a ></ td >
</ tr >


< %
set rsSmallClass1 = server.CreateObject( " adodb.recordset " )
rsSmallClass1.open
" Select*FromsmallclassWherebigclassname=' " & rsBigClass1( " bigclassname " ) & " ' " ,conn, 1 , 1
if not (rsSmallClass1.bof and rsSmallClass1.eof) then

%
>
< trvalign = " top " >
< td >< tableborder = 0 cellspacing = 0 cellpadding = 0 id = " <%= " a " &i%> " style = " display:none " >< tr >< td >< % do while not rsSmallClass1.eof% >< trvalign = " top " >
< td >& nbsp; & nbsp; & nbsp; & nbsp; < ahref = " Product.asp?bigclassname=<%=rsBigClass1( " bigclassname " )%>&smallclassname=<%=rsSmallClass1( " smallclassname " )%> " class = " my1 " >< % = rsSmallClass1( " smallclassname " )% ></ a >< %rsSmallClass1.movenext
loop % ></ td ></ tr ></ table ></ td >
</ tr >
< %

end if
rsSmallClass1.close
set rsSmallClass1 = nothing
rsBigClass1.movenext
loop
rsbigclass1.close
set rsbigclass1 = nothing
%
>
</ table >

你可能感兴趣的:(JavaScript,asp)