| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 991 人关注过本帖
标题:[求助]树形菜单(盼求)
只看楼主 加入收藏
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
结帖率:68.57%
收藏
 问题点数:0 回复次数:7 
[求助]树形菜单(盼求)
ASP界的前辈们!能帮帮我解决树形菜单问题?谢谢!!

希望的结果是“在左窗口显示的是树形菜单”,比如:
+ 年级(点击年级,然后展开如下)
--一年级(点击年级后的展开,再点击“一年级”后,在右窗口打开一年级的输入窗口等信息!)
--二年级
--三年级
.....................

盼回复为谢,最好是多级的数形,如:点“一年级”还可以展开等。

谢谢!谢谢!!





搜索更多相关主题的帖子: 树形 菜单 年级 color 
2005-12-07 17:37
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 

帮帮忙呀!


我是农家的孩子,我有农家孩子的本色!
2005-12-07 18:26
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
怎么没人帮我呀!

我是农家的孩子,我有农家孩子的本色!
2005-12-08 15:31
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

〈!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"〉
〈!-- saved from url=(0045)http://yangmingsheng1.diy.myrice.com/list.htm --〉
〈HTML〉〈HEAD〉〈TITLE〉〈/TITLE〉
〈META http-equiv=Content-Type content="text/html; charset=gb2312"〉
〈META content="MSHTML 6.00.2800.1106" name=GENERATOR〉
〈STYLE type=text/css〉
A {
TEXT-TRANSFORM: none; TEXT-DECORATION: none
}

UNKNOWN {
TEXT-DECORATION: underline
}
.style1 {color: #333333}
.style2 {font-size: 18px}
body {
background-color: #f7f7ff;
}
〈/STYLE〉
〈/HEAD〉
〈BODY background=list.files/yangmingsheng1.diy.myrice.htm〉
〈SCRIPT〉
function initIt(){
divColl=document.all.tags("DIV");
for(i=0; i〈divColl.length; i++) {
whichEl=divColl(i);
if(whichEl.className=="child")whichEl.style.display="none";}
}
function expands(el) {
whichEl1=eval(el+"Child");
if (whichEl1.style.display=="none"){
initIt();
whichEl1.style.display="block";
}else{whichEl1.style.display="none";}
}
onload=initIt;
〈/SCRIPT〉
〈TD vAlign="top" width="100%" height="100%"〉 
〈TABLE style="WIDTH: 104px; HEIGHT: 91px" cellSpacing=0 cellPadding=0 width=104%
background=list.files/yangmingsheng1.diy.myrice.htm border=0〉
〈!--DWLayoutTable--〉
〈TBODY〉
〈TR〉
〈TD width="104" height="28" valign="top"〉
〈P align=center class="style1"〉 〈/P〉
〈P align=center class="style1"〉 〈/P〉
〈P align=center class="style1 style2"〉好友分组〈/P〉〈/TD〉
〈/TR〉
〈/TBODY〉〈/TABLE〉
〈BR〉
 〈A
href="javascript:expands('h1')"〉〈IMG height=30 alt="" hspace=0
src="list.files/koka.gif" width=28 border=0〉〈FONT color=#0000ff
size=2〉万王天地〈/FONT〉〈/A〉
〈DIV class=child id=h1Child〉  〈A
href="http://yangmingsheng1.myrice.com/kokindex.htm" target=middleright〉〈FONT
color=#000000〉〈FONT size=2〉万王天地〈/FONT〉〈/A〉〈BR〉
〈/DIV〉
 〈A
href="javascript:expands('h2')"〉〈IMG height=30 alt="" hspace=0
src="list.files/koka.gif" width=28 border=0〉〈FONT color=#0000ff
size=2〉万王天地〈/FONT〉〈/A〉
〈DIV class=child id=h1Child〉  〈A
href="http://yangmingsheng1.myrice.com/kokindex.htm" target=middleright〉〈FONT
color=#000000〉〈FONT size=2〉万王天地〈/FONT〉〈/A〉〈BR〉
〈/DIV〉
〈DIV〉〈BR〉
〈BR〉
〈/DIV〉
〈div〉〈/div〉
〈div class=child〉〈font size=+0〉〈font size=+0〉〈font size=+0〉〈font size=+0〉〈font
size=+0〉〈br〉
〈/font〉〈/font〉〈/font〉〈/font〉〈/font〉〈/div〉
〈/BODY〉〈/HTML〉
以上为树型菜单HTML源代码,楼主可以看看。

2005-12-08 15:40
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
用JavaScript写的。
2005-12-08 15:41
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2005-12-08 15:48
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
[CODE]
〈!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"〉
〈!-- saved from url=(0045)http://yangmingsheng1.diy.myrice.com/list.htm --〉
〈HTML〉〈HEAD〉〈TITLE〉〈/TITLE〉
〈META http-equiv=Content-Type content="text/html; charset=gb2312"〉
〈META content="MSHTML 6.00.2800.1106" name=GENERATOR〉
〈STYLE type=text/css〉
A {
TEXT-TRANSFORM: none; TEXT-DECORATION: none
}
UNKNOWN {
TEXT-DECORATION: underline
}
.style1 {color: #333333}
.style2 {font-size: 18px}
body {
background-color: #f7f7ff;
}
〈/STYLE〉
〈/HEAD〉
〈BODY background=list.files/yangmingsheng1.diy.myrice.htm〉
〈SCRIPT〉
function initIt(){
divColl=document.all.tags("DIV");
for(i=0; i〈divColl.length; i++) {
whichEl=divColl(i);
if(whichEl.className=="child")whichEl.style.display="none";}
}
function expands(el) {
whichEl1=eval(el+"Child");
if (whichEl1.style.display=="none"){
initIt();
whichEl1.style.display="block";
}else{whichEl1.style.display="none";}
}
onload=initIt;
〈/SCRIPT〉
〈TD vAlign="top" width="100%" height="100%"〉 
〈TABLE style="WIDTH: 104px; HEIGHT: 91px" cellSpacing=0 cellPadding=0 width=104%
background=list.files/yangmingsheng1.diy.myrice.htm border=0〉
〈!--DWLayoutTable--〉
〈TBODY〉
〈TR〉
〈TD width="104" height="28" valign="top"〉
〈P align=center class="style1"〉 〈/P〉
〈P align=center class="style1"〉 〈/P〉
〈P align=center class="style1 style2"〉好友分组〈/P〉〈/TD〉
〈/TR〉
〈/TBODY〉〈/TABLE〉
〈BR〉
 〈A
href="javascript:expands('h1')"〉〈IMG height=30 alt="" hspace=0
src="list.files/koka.gif" width=28 border=0〉〈FONT color=#0000ff
size=2〉万王天地〈/FONT〉〈/A〉
〈DIV class=child id=h1Child〉  〈A
href="http://yangmingsheng1.myrice.com/kokindex.htm" target=middleright〉〈FONT
color=#000000〉〈FONT size=2〉万王天地〈/FONT〉〈/A〉〈BR〉
〈/DIV〉
 〈A
href="javascript:expands('h2')"〉〈IMG height=30 alt="" hspace=0
src="list.files/koka.gif" width=28 border=0〉〈FONT color=#0000ff
size=2〉万王天地〈/FONT〉〈/A〉
〈DIV class=child id=h1Child〉  〈A
href="http://yangmingsheng1.myrice.com/kokindex.htm" target=middleright〉〈FONT
color=#000000〉〈FONT size=2〉万王天地〈/FONT〉〈/A〉〈BR〉
〈/DIV〉
〈DIV〉〈BR〉
〈BR〉
〈/DIV〉
〈div〉〈/div〉
〈div class=child〉〈font size=+0〉〈font size=+0〉〈font size=+0〉〈font size=+0〉〈font
size=+0〉〈br〉
〈/font〉〈/font〉〈/font〉〈/font〉〈/font〉〈/div〉
〈/BODY〉〈/HTML〉[/CODE]

我是农家的孩子,我有农家孩子的本色!
2005-12-09 12:20
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
[CODE]<%
'**************************************************************
'**************************************************************
'**版本:Toumh无极限菜单树 **
'**编号:TOUMH-20051124 **
'**作者:阳光白雪 **
'**主页:http://www.ec2002.com **
'**邮件:chenmanyi0818@126.com **
'**声明:转载或使用时请保留程序的完整性,请保留以上信息。 **
'** 禁止用于任何商业用途! **
'**************************************************************
'**************************************************************
dataurl=Server.MapPath("menutree.mdb")'数据库地址
dim conn,strQuery,rs
set conn = server.CreateObject("adodb.connection")
conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&dataurl
strQuery="select * from menufun"
set rs=server.createobject("adodb.recordset")
rs.open strQuery,conn,1,1
allnum=rs.RecordCount
'取得最大的层数MaxLevel
MaxLevel=1
for i=1 to allnum
if rs("PartLevel")>MaxLevel then
MaxLevel=rs("PartLevel")
else
MaxLevel=MaxLevel
end if
rs.movenext
next
rs.close
set rs=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Toumh无极限菜单树</title>
<style type="text/css">
<!--
td {
font-size: 12px;
}
-->
</style>
<script language="javascript">
<!--
function divshow(cmy1,cmy2,cmy3)
//展开/合并菜单函数
{
if(document.all("div"+cmy1+cmy2+cmy3).style.display==""){
document.all("div"+cmy1+cmy2+cmy3).style.display="none"
}else{
document.all("div"+cmy1+cmy2+cmy3).style.display=""
}
}
//-->
</script>
</head>
<body bgcolor="#6699CC" topmargin="0">
<table border="0" cellpadding="0" cellspacing="0">
<tr onClick="javascript:divshow(1,0,1);" style="cursor:hand"><TD><img src="images/admin.gif">Toumh无极限菜单树</TD></tr>
<%
dim toumh(10) '定义用于存放菜单前显示树图片的数组,如果应用时的最大级数大于十,请扩大数组维数
call menutree(1,0,MaxLevel,1)'首次调用菜单输出函数
'第一个参数:菜单的级数
'第二个参数:父菜单的ID,一级菜单默认为零
'第三个参数:菜单的最大级数
'第四个参数:用于区分层的名称,方便实现菜单的展开合并
%>
</table>
<%
'funno 菜单的级数
'funcid 父菜单的ID,一级菜单父级ID值为0
'MaxLevel 菜单的最大级数
'divno 用于区分层的名称,方便实现菜单的展开合并
'menutree() 数形菜单输出函数
function menutree(funno,funcid,MaxLevel,divno)
dim rsfun,numfun,funcidfun
strQuery1="select * from menufun where sup_funcid='"&funcid&"'"
set rsfun=server.createobject("adodb.recordset")
rsfun.open strQuery1,conn,1,1
numfun=rsfun.RecordCount
response.Write("<tr><td>")
response.Write("<div id='div"&funno&funcid&divno&"' style='display:none'>")'输出层,并根据相关参数给层定义唯一的ID名称
response.Write("<table border='0' cellpadding='0' cellspacing='0'>")
for j=1 to numfun
funcidfun=rsfun("funcid")
if j=numfun then '判断是否是本级菜单的最后一个
toumh(funno)="space.gif" '是则输出空白图片space.gif
else
toumh(funno)="line_v.gif" '否则输出竖线图片line_v.gif
end if
'判断是否有下级菜单
strQuery2="select * from menufun where sup_funcid='"&funcidfun&"'"
set rsfun2=server.createobject("adodb.recordset")
rsfun2.open strQuery2,conn,1,1
numfun2=rsfun2.RecordCount
'如果numfun2>0则有,反之则无
if numfun2 > 0 then
response.Write("<tr onClick='javascript:divshow("&funno+1&","&funcidfun&","&j&");' style='cursor:hand'>")
'用单击事件调用展开/合并菜单函数
else
response.Write("<tr style='cursor:hand'>")
end if
response.Write("<td>")
if numfun2 > 0 then
treeico="open_normal.gif"
if j=numfun then
treeico="open_end.gif"
end if
else
treeico="none_normal.gif"
if j=numfun then
treeico="none_end.gif"
end if
end if
for m=1 to cint(funno)-1 '根据当前菜单的级数输出菜单前的数形图片
response.Write("<img src='images/"&toumh(m)&"' align='absMiddle'>")
next
if not rsfun("enable") then '判断菜单项是否可用,不可用的菜单名用#FF0000色显示
response.Write("<img src='images/"&treeico&"' align='absMiddle'><font color='#ff0000'>"&rsfun("funcname")&"</font>")'输出不可用菜单名
else
response.Write("<img src='images/"&treeico&"' align='absMiddle'>"&rsfun("funcname"))'输出可用菜单名
end if
response.Write("</td>")
response.Write("</tr>")
if cint(funno)<cint(MaxLevel) then
call menutree(cint(funno)+1,funcidfun,MaxLevel,j) '递归调用 menutree()函数
end if
rsfun.movenext
next
'response.Write("</td></tr>")
response.Write("</table></div>")
response.Write("</td></tr>")
end function
%>
<!-- 程序中未能改变菜单展开/合并时的图片的属性,有兴趣的网友可以自己添加该功能 -->
</body>
</html>[/CODE]

我是农家的孩子,我有农家孩子的本色!
2005-12-09 12:39
快速回复:[求助]树形菜单(盼求)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016079 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved