一百分求一个菜单程序

linpast 2003-12-12 02:42:21
我想做一个像这个网站的 http://shop.lenovo.com/Channel_home/ 左边产品分类那样的菜单,这个网站有些地方是三级目录的,我只要二级目录就可以了.
不过要可以在在数据库里更改的,也就是说在后台添加一个,这边的菜单就自动添加.
谢谢!
...全文
98 15 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
linpast 2003-12-13
  • 打赏
  • 举报
回复
那要像那个网站那样要代码要怎么写呀?
谢谢
nchen123 2003-12-12
  • 打赏
  • 举报
回复
如果考虑运用 xml 技术就可以作出一个通用的菜单, 可以运用于任何现有的数据库结构。

专门写一个脚本读取数据库生成 xml 文件。

后台更新的时候只需要进行正常的进行数据库的增删,修改等等操作, 然后调用一次上面我说的这个脚本, 就可以实现更新。

这样实际上每次在前台读取的是静态的内容, 所以速度非常快。

关于这个问题我和超级大笨狼讨论过一次, 我想他可能是误解了。 他说这个要用 xmlhttp 来实现,所以慢, 实际上是和 xmlhttp 没有关系的。
nchen123 2003-12-12
  • 打赏
  • 举报
回复
to bananasmiling(hello找我) :

超级大笨狼的这个联动菜单有个前提,就是你的数据库必须照他这个办法来设计, 不能运用于已有的数据库。

所以我觉得他这个联动还是有些缺陷。
linpast 2003-12-12
  • 打赏
  • 举报
回复
我要的不是那一种.
要联想这个网站那样,
会弹出一个菜单出来.
并且数据库添加一条,
前也添加一条.
谢谢!
linpast 2003-12-12
  • 打赏
  • 举报
回复
我要的不是那一种.
要你联想这个网站那样,
会弹出一个菜单出来.
并且数据库添加一条,
前也添加一条.
谢谢!
tigerwen01 2003-12-12
  • 打赏
  • 举报
回复
请参考tigerwen01的两级连动菜单:
http://www.csdn.net/develop/read_article.asp?id=18690
http://www.csdn.net/develop/read_article.asp?id=18691
zhanghao5188 2003-12-12
  • 打赏
  • 举报
回复
用层做快!! 行为里的显示,隐蔽!!
Struggling 2003-12-12
  • 打赏
  • 举报
回复
我也建议你去找阿信的网站,里面有各种各样的。
http://fason.nease.net
海鸥 2003-12-12
  • 打赏
  • 举报
回复
使用dreamweaver mx,先建一图片,然后选中图片,选择窗口菜单→行为→点击+号→显示弹出式菜单,然后在里面自己设定就OK了,很简单.
swich 2003-12-12
  • 打赏
  • 举报
回复
去阿信那找找看

http://fason.nease.net
linpast 2003-12-12
  • 打赏
  • 举报
回复
linpast22@163.net
bananasmiling 2003-12-12
  • 打赏
  • 举报
回复
现在我用JAVASCRIPT做出了一个,代码如下:

<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from branchcite where citeparent<>0"
rs.open sql,conn,1,1
response.write rs.recordcount
%>

<script language = "javascript">
var branchcount;
branchcount=0;
cites = new Array();
<%
count = 0
do while not rs.eof
%>
cites[<%=count%>] = new Array("<%= trim(rs("citename"))%>","<%= trim(rs("citeparent"))%>","<%= trim(rs("citeid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
branchcount=<%=count%>;
</script>

<%

set rs=server.createobject("adodb.recordset")
sql = "select * from errType order by TypeId"
rs.open sql,conn,1,1
response.write rs.recordcount
%>
<script language = "javascript">

classcount=0;
errclass = new Array();
<%
count = 0
do while not rs.eof
%>
errclass[<%=count%>] = new Array("<%= trim(rs("typecontent"))%>","<%= trim(rs("typeclass"))%>","<%= trim(rs("typeid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
classcount=<%=count%>;
</script>

<script language = "javascript">
function changebranch(branchid)
{
document.formaddlog.cite.length = 0;

var branchid=branchid;
var i;
for (i=0;i < branchcount; i++)
{
if (cites[i][1] == branchid)
{
document.formaddlog.cite.options[document.formaddlog.cite.length] = new Option(cites[i][0], cites[i][2]);
}
}

}


function changeerrtype(Classid)
{
document.formaddlog.ErrType.length = 0;

var Classid=Classid;
var i;
for (i=0;i < classcount; i++)
{
if (errclass[i][1] == Classid)
{
document.formaddlog.ErrType.options[document.formaddlog.ErrType.length] = new Option(errclass[i][0],errclass[i][2]);
}
}

}
</script>

bananasmiling 2003-12-12
  • 打赏
  • 举报
回复
Access数据库
● 数据库名:tree
● 表名:tree
● 字段名的设计
ID 文本类型 编码
Name 文本类型 节点文字
HyperLink 文本类型 相关信息
---------------------------------------------------
ID | Name | HyperLink
---------------------------------------------------
1_1_1 | ASP | http://www.csdn.net
---------------------------------------------------
1_1_1_1 | DHTML | http://www.csdn.net
---------------------------------------------------
1_2_2 | JAVA | http://www.csdn.net
---------------------------------------------------
1_1_2 | JavaScript | http://www.csdn.net
---------------------------------------------------
1_2_1 | VB | http://www.csdn.net
---------------------------------------------------
1_2_1_2 | VBA | http://www.csdn.net
---------------------------------------------------
1_1 | WEB开发 | http://www.csdn.net
---------------------------------------------------
1 | WWW.CSDN.net | http://www.csdn.net
---------------------------------------------------
1_2_1_1 | 基础类 | http://www.csdn.net
---------------------------------------------------
1_3_1 | 基础类 | http://www.csdn.net
---------------------------------------------------
1_2 | 开发语言 | http://www.csdn.net
---------------------------------------------------
1_1_1_2 | 内建对象 | http://www.csdn.net
---------------------------------------------------
1_3 | 数据库 | http://www.csdn.net
----------------------------------------------------
文件:nolimited.asp经简单测试好用!代码如下:
<html>
<head>
<META name=VI60_defaultClientScript content=VBScript>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>asp树的研究</title>
</head>
<style type="text/css">
<!--
.aa {
font-size: 14px;
color: #000000;
text-align: center;
vertical-align: middle;
letter-spacing: 0px;
word-spacing: 0px;
}
-->
</style>
<body bgcolor="DEE3F7">
<%
dim cn,rs,SQL ,Para,NumChild
set cn=server.CreateObject("ADODB.connection")
set rs=server.createobject("ADODB.recordset")
set rs1=server.createobject("ADODB.recordset")
cn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tree.mdb")
SQL="Select * from tree order by ID"
rs.open SQL,cn,3,2
do while not rs.EOF
SQL="Select ID from tree where ID like '" & rs("ID") & "%' and ID<>'" & rs("ID") & "' order by ID"
Para=rs("ID") & "|"
NumChild=0
rs1.open SQL,cn, 3,2
NumChild=rs1.RecordCount
do while not rs1.EOF
Para =Para & rs1("ID") & "|"
rs1.MoveNext
loop
Para=cstr(trim(left(Para,len(Para)-1)))
rs1.Close
%>
<table id="T<%=rs("ID")%>"
border=1
cellpadding=0
cellspacing=0
bordercolor="#DEE3F7"
class="aa"
abbr="<%=Para%>"
summary=<%=checkid(rs("ID"))%>
style="cursor:hand"
onClick="vbs:subtree '<%=Para%>'" >

<tr>
<td width="<%=17+checkid(rs("ID"))*20%>"
height="20" align="right">
<table width="20" height="20" border="1" cellpadding="0" cellspacing="0" bordercolor="#DEE3F7">
<tr>

<td align="center" valign="middle" bordercolor="#000000" id="R<%=rs("ID")%>" ><%if NumChild=0 then Response.Write "." else Response.Write "-"%></td>
</tr>
</table>
</td>

<td height="20"
nowrap
bordercolor="#FFFFFF"
onMouseOver="vbs:me.bgcolor='#CCCCCC':me.bordercolor='#999999'"
onMouseOut="vbs:me.bgcolor='#DEE3F7':me.bordercolor='#ffffff'"
title="<%=rs("HyperLink")%>">
<%=rs("Name")%></td>
</tr>
</table>


<%
rs.MoveNext
loop
rs.Close:set rs=nothing
cn.Close:set cn=nothing
function checkid(x)
dim Tempnum
Tempnum=0
for i=1 to len(x)
if mid(x,i,1)="_" then
Tempnum=Tempnum+1
end if
next
checkid=Tempnum
end function


%>
<script language=VBS>
sub subtree(Client_para)
if instr(Client_para,"|")=0 then exit sub
Myarray=split(Client_para,"|")
Mytext=eval("R" & Myarray(0) & ".innertext")
select case Mytext
case "+"
document.all.item("R" & Myarray(0)).innertext="-"
for i=1 to ubound(Myarray)
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")=1 then
document.all.item("T" & Myarray(i)).style.display="block"
end if
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")>1 then
document.all.item("T" & Myarray(i)).style.display="none"
end if
next
case "-"
document.all.item("R" & Myarray(0)).innertext="+"
for i=1 to ubound(Myarray)
if eval("T" & Myarray(i) & ".summary")-eval("T" & Myarray(0) & ".summary")>=1 then
document.all.item("T" & Myarray(i)).style.display="none"
if eval("R" & Myarray(i) & ".innertext")="-" then
document.all.item("R" & Myarray(i)).innertext="+"
end if
end if
next
end select
set Myarray=nothing
end sub

Sub document_onselectstart
document.selection.clear
End Sub

if isobject(eval("T1")) then
subtree document.all("T1").abbr
subtree document.all("T1").abbr
end if
</script>

</html>

Primer2002cn 2003-12-12
  • 打赏
  • 举报
回复
我这有一个现成的,留下MAIL吧!
vivisogood 2003-12-12
  • 打赏
  • 举报
回复
搜索联动例子一大堆

28,409

社区成员

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

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