日期:2014-05-17  浏览次数:20878 次

如何修改以下代码使其能实现 无限级 动态树形菜单
<!--# include file = admin_conn.asp -->
<SCRIPT language=javascript1.2>
//parent.document.title='<%'=Dvbbs.Forum_info(0)%>';
function showsubmenu(ss,ii,aa,openimg,closeimg)
{
var menuobjedt=document.getElementById(ss);
if (menuobjedt)
{
 if (menuobjedt.style.display=="none") 
  {menuobjedt.style.display="";
  document.getElementById(ii).src="treepic/nofollow.gif";
  document.getElementById(ii).alt="关闭菜单";
  document.getElementById(aa).src="treepic/"+openimg;
  document.getElementById(aa).alt="关闭菜单";
}
 else
  {menuobjedt.style.display="none"; 
document.getElementById(ii).src="treepic/plus.gif";
document.getElementById(ii).alt="展开菜单";
document.getElementById(aa).src="treepic/"+closeimg;
document.getElementById(aa).alt="展开菜单";
  }
}
}
function reloadpage(){
parent.window_left.location.reload();
}
</SCRIPT>


<%
if trim(request.QueryString("lm"))<>"" then
lm_tree=trim(request.QueryString("lm"))
lm_tree2=trim(request.QueryString("lm2"))
lm_t=trim(request.QueryString("lm_t"))
'response.Write(lm_t)
else
lm_tree=rs("lm")
if rs("lm3")<>"0" then
lm_tree2=rs("lm3")
elseif rs("lm2")<>"0" then
lm_tree2=rs("lm2")
else
lm_tree2=rs("lm")
end if
lm_t=rs("lm2")
end if
zblb="<table cellpadding=0 cellspacing=0 style='width:100%' >"

sql = "select id,lm from lm where id="&lm_tree&""
Set rs_tree = Server.CreateObject("ADODB.RecordSet")
rs_tree.Open sql,conn,1,1
if not rs_tree.eof then

  zblb=zblb&"<tr>"
  zblb=zblb&"<td width=100% class=tablebody2>"
zblb=zblb&"<img src=treepic/nofollow.gif >"
zblb=zblb&"<img src=treepic/index.gif >"
zblb=zblb&"<b><a href=news_more.asp?lm="&rs_tree("id")&"&lm2="&rs_tree("id")&"><font color=#000000>"&rs_tree("lm")&"</font></a></b>"
zblb=zblb&"</td>"
  zblb=zblb&"</tr>"

sql = "select id,lm2 from lm where lmid='"&rs_tree("id")&"'"
Set rs1_tree = Server.CreateObject("ADODB.RecordSet")
rs1_tree.Open sql,conn,1,1
if rs1_tree.recordcount=0 then
'zblb=zblb&"<tr><td class=tablebody1 align=center vAlign=top><font color=#999999>暂时无子栏目</font></td></tr>"
zblb=zblb&"<tr><td>"
zblb=zblb&"<table cellpadding=0 cellspacing=0 align=center width='100%'>"
zblb=zblb&"<tr><td width=15 background=treepic/i.png></td>"
zblb=zblb&"<td class=tablebody1 width=15 background=treepic/l.png></td>"
zblb=zblb&"<td class=tablebody1 align=left vAlign=top><font color=#999999>暂时无子栏目</font></td>"
zblb=zblb&"</tr>"
zblb=zblb&"</table>"
zblb=zblb&"</td></tr>"
else
j=0
do while not rs1_tree.eof

menuname="board"&j

zblb=zblb&"<tr>"
zblb=