请教一个算法问题

fineboy_2001 2004-09-27 11:58:05
数据库表的数据结构如下:
xh id name url bh
1 001 人事管理 sadf 2
2 001001 劳资管理 sadfsda 4
3 001001001 asdfasdf asdf 9
4 001001002 asdf asdf 10
5 001001002001 111111111212 sdfsdf 12
6 001001002002 11111113 sdafsdf 11
7 001001002002001 1111111113s sdfsdf 13
8 002 sdfsdaf2211 2222 5
9 002001 sdfsdf11 111 3
10 002003 sdafsda asdf 16
11 003 sdafds asdf 19
12 003001 sdafdsa1 sdaf 17
13 003002 asdf2 sdf 18
14 004 444 dsf 20
15 004001 44411 sdaf 21
16 004002 44422 sdaf 22
17 005 555 sadf 23
18 005001 55511 sdfsdf 24
19 005002 55522 dsafsd 25
20 006 666 safd 26
21 006001 66611 sdaf 27
22 006002 66622 asdf 28
23 007 777 sadf 29
24 007001 7771 sdaf 30
25 009 9999 sdfdsf 32
26 010 1212 sdafsdf 33
27 012 1111 sdfsdf 35
28 012001 dsfsdf 232323 36
29 012002 www sdfdsf 37
///////////////////////////////////////////////////////
由id生成动态菜单,菜单椌件引用如下:
<script>
/*建立5个菜单实例对象*/
var m1=new alai_menu_xp()
var m2=new alai_menu_xp()
var m3=new alai_menu_xp()
var m4=new alai_menu_xp()
var m5=new alai_menu_xp()
var m6=new alai_menu_xp()

/*菜单栏*/
var mc=new menu_bar_xp(1,1);
mc.add("菜单功能演示",m1)


/*添加菜单项*/
m1.add("显示子菜单","","sub",m3)
m1.add("执行JS命令","","js","alert('谢谢使用');")
m1.add("隐藏菜单","","hide")
m1.add("去google一下","","url","http://www.google.com","_blank")
m1.seperate()//加分隔线
var item=m1.add("enable=false","","js","alert('谢谢使用');")
item.enable=false
var itemDel=m1.add("请把我移除","")
itemDel.execute=function(){itemDel.remove();}
m1.seperate()//加分隔线
m1.add("动态增加菜单项...").execute=function(){var txt=prompt("输入文字:");m1.add(txt,"images/note.gif");}





m3.add("无限级子菜单演示","images/global.gif","sub",m4)
m3.seperate()
m3.add("刷新页面","images/refresh.gif")
m3.add("添加到收藏夹","images/star.gif")
m3.add("设为首页","images/home.gif")
m3.seperate()
m3.addLink("http://www.9499.net","9499.NET主页","","images/home.gif")
m3.addLink("http://www.9499.net?go=ly","访客留言中心","","images/rose.gif")
m3.addLink("http://www.9499.net?go=tc","在线教程","","images/teach.gif")

m4.add("无限级子菜单演示","images/gift.gif","sub",m5)
m4.seperate()
m4.add("刷新页面","images/refresh.gif")
m4.add("添加到收藏夹","images/star.gif")
m4.add("设为首页","images/home.gif")
m4.seperate()
m4.addLink("http://www.9499.net","9499.NET主页","","images/home.gif")
m4.addLink("http://www.9499.net?go=ly","访客留言中心","","images/rose.gif")
m4.addLink("http://www.9499.net?go=tc","在线教程","","images/teach.gif")

m5.add("无限级子菜单演示","images/flower.gif","sub",m3)
m5.seperate()
m5.add("刷新页面","images/refresh.gif")
m5.add("添加到收藏夹","images/star.gif")
m5.add("设为首页","images/home.gif")
m5.seperate()
m5.addLink("http://www.9499.net","9499.NET主页","","images/home.gif")
m5.addLink("http://www.9499.net?go=ly","访客留言中心","","images/rose.gif")
m5.addLink("http://www.9499.net?go=tc","在线教程","","images/teach.gif")

m3.item[1].execute=m4.item[1].execute=m5.item[1].execute=function(){self.history.go(0);}
m3.item[2].execute=m4.item[2].execute=m5.item[2].execute=function()
{
window.external.addFavorite("http://www.9499.net","创意无限,精彩无限--WWW.9499.NET");
}
m3.item[3].execute=m4.item[3].execute=m5.item[3].execute=function()
{
event.srcElement.style.behavior="url(#default#homepage)";
event.srcElement.setHomePage("http://www.9499.net");
}

/*显示右键菜单*/
document.body.oncontextmenu=function()
{
event.returnValue=false;
}
document.body.onmousedown=function()
{
if(event.button==2)
m3.show();
}


</script>
...全文
62 5 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
whnnet 2004-09-27
  • 打赏
  • 举报
回复
数据库输出到js里即可
ouyld 2004-09-27
  • 打赏
  • 举报
回复
fineboy_2001 2004-09-27
  • 打赏
  • 举报
回复
to whnnet(赚钱攒嫁妆)
你好象用过,有原程序么,有就分就给你了
cxz7531 2004-09-27
  • 打赏
  • 举报
回复
把数据库的内容用jsp导入一个javascript的数组,在浏览器端用js生成树,具体实现还比较烦琐
whnnet 2004-09-27
  • 打赏
  • 举报
回复
For i = 1 To 6
Response.Write "var m" & i & "=new alai_menu_xp()" & vbCrLf
Response.Write "m" & i & .add('xxxxxxxxx')" & vbCrLf
Response.Write "m" & i & .seperate()" & vbCrLf
.................................
Next
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-09-27 11:58
社区公告
暂无公告