CSDN博客

img ycl111

asp树型菜单函数(原创)

发表于2004/10/12 14:08:00  1959人阅读

<%function ShowTreeMenu(rs001,layer)
if not rs001.eof then
 %>
  <script language="javascript">
   <!--
   function display1(Q_subtree,Q_img){
    
     if (Q_subtree.style.display=="none"){
       Q_subtree.style.display="";    
     Q_img.src="tree_collapse.gif";
    }
     else
      {
       Q_subtree.style.display="none";     
       Q_img.src="tree_expand.gif";
     }
   }
   -->
  </script>
 <table border="0" cellspacing="0" cellpadding="0">
 <%
 i=1
 while not rs001.eof
 sql="select * from menu where parent_id="&rs001("id")
 set result_sub=result(sql)
  if not result_sub.eof then
  img="img"&layer&"_"&i
  subtree="subtree"&layer&"_"&i
  %>
    <tr>
   <td width="12"><IMG src="tree_collapse.gif" border="no" name="<%=img%>" onclick="javascript:display1(document.all.<%=subtree%>,document.all.<%=img%>);" ></td>
   <td><%=rs001("nam")%></td>
    </tr>
    <tr  id="<%=subtree%>">
   <td>&nbsp;</td>
   <td>
  <%
  layer=layer+1
  ShowTreeMenu result_sub,layer
  layer=layer-1
  else
   if rs001("url")<>"" then
   %>
     <tr>
    <td width="12"><IMG src="tree_collapse.gif" border="no"></td>
    <td><%=rs001("nam")%></td>
     </tr>
   <%
   else
   %>
     <tr>
    <td width="12"><IMG src="tree_collapse.gif" border="no"></td>
    <td><%=rs001("nam")%></td>
     </tr>
   <%
   end if
  end if
 rs001.movenext
 i=i+1
 wend
%>
</table>
<%
end if
end function
%>
阅读全文
0 0

相关文章推荐

img
取 消
img