!!寻求一份动态菜单的代码。谢谢!(在线等候!——)

yangsm 2003-09-18 10:30:43
自己找了一份,但是出现好多错误,自己没有改过来,代码如下:
<%
Dim Cn,Rs
Dim StrDSN, SQL1,SQL2
Set cn=Server.CreateObject("ADODB.connection")
Set Rs1 = Server.CreateObject("ADODB.Recordset")
Set Rs2 = Server.CreateObject("ADODB.Recordset")
StrDSN = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../database/db1.mdb")
Cn.Open strDSN
SQL1="select * from father"
Rs1.Open SQL1,cn,3,2
Rs1.MoveFirst
Response.Write "<SCRIPT LANGUAGE=vbs>" & chr(13)
Response.Write "public Father_Count"& chr(13)
Response.Write "Father_Count=" & rs1.RecordCount & chr(13) '将父亲的数量传给客户端
Response.Write "</SCRIPT>" & chr(13)%>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#66CCFF" style="cursor:hand">
<%do while not rs1.EOF %>
<tr>
<td width="91" bordercolor="#FFFFFF" bgcolor="#0099CC" id="father_<%=rs1("father_id")%>" onclick="vbs:call aaa(me)"><%=rs1("father_name")%> </td>
</tr>
<% SQL2="select * from child where father_id='" & rs1("father_id")&"'"
rs2.Open SQL2,cn,3,2
do while not rs2.EOF %>
<tr id="child_<%=(rs1("father_id") & "_" & rs2("child_id"))%>" style="display:none" >
<td bordercolor="#FFFFFF" onclick="vbs:msgbox '现在执行
-<%=rs2("child_name")%>!'">   <%=rs2("child_name")%></td>
</tr>
<%rs2.MoveNext
loop
rs2.Close %>
<% rs1.MoveNext
loop
rs1.Close
Cn.Close
set rs1=nothing
set rs2=nothing
set cn=nothing
%>
</table>
<SCRIPT LANGUAGE=vbs>

sub ShowChild(x,y)'显示隐藏子过程,x代表父亲id,y代表显示1还是隐藏0
dim n '用来循环的东西
n=1
do
if isobject(eval("child_" & x & "_" & n))then
if y=1 then
window.execScript "child_" & x & "_" & n & ".style.display='block'","vbs"'显示
else
window.execScript "child_" & x & "_" & n & ".style.display='none'" ,"vbs"'隐藏
end if
else
exit do
end if
n=n+1
loop
end sub

sub aaa(obj)
dim j'用来循环的东西
for j=1 to Father_Count
if j=cint(right(obj.id,len(trim(obj.id))-7)) then
ShowChild j,1'显示自己子菜单
else
ShowChild j,0'隐藏其余的子菜单
end if
next
end sub
ShowChild 1,1
</SCRIPT>
还请各位帮忙看一下!谢谢!
...全文
31 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangsm 2003-09-19
  • 打赏
  • 举报
回复
一天了都没有人来看一下,这个分也送不出去了。还没有进来吗?要结贴了。
yangyanggood 2003-09-19
  • 打赏
  • 举报
回复
我这里现在已经有了,谢谢各位!
ouyanggz 2003-09-19
  • 打赏
  • 举报
回复
我有现成的,联系我:ouyanggz@163.com
wang7655 2003-09-19
  • 打赏
  • 举报
回复
关注一下
yangyanggood 2003-09-19
  • 打赏
  • 举报
回复
关注……
yangyanggood 2003-09-19
  • 打赏
  • 举报
回复
关注……
yangyanggood 2003-09-19
  • 打赏
  • 举报
回复
关注……
freespace520 2003-09-19
  • 打赏
  • 举报
回复
我有现成的代码,你要的话,MSN联系我!
lgmmylove@hotmail.com
yangsm 2003-09-19
  • 打赏
  • 举报
回复
终于有人来了!原理就是你所说的,但现在是没有实现?
iamsangster 2003-09-19
  • 打赏
  • 举报
回复
没看懂要求,说一下先,可以设定一个参数如f
f=1 时显示,点击时设f=0,
f=0 隐藏
yangsm 2003-09-18
  • 打赏
  • 举报
回复
各位同行,来帮忙看一下吗?我现在只有靠自己来顶了!
yangsm 2003-09-18
  • 打赏
  • 举报
回复
请高手帮忙看一下!或者说给我一份代码!yangyang_335@hotmail.com谢谢!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧