新华电脑教育网 设为首页 | 加入收藏 | 网站地图 | 招生咨询热线电话:010-67958088  
新华电脑教育北京新华电脑学校→咨询电话: 010-67958088  学校地址: 北京市大兴区旧宫镇庑殿路18号 (729公交总站向北300米) 88159900  咨询QQ-1:北京新华电脑学校欢迎您,我们将热情为您提供最专业的咨询服务
北京新华电脑学校学生组织:学生会网站项目部网络项目部设计项目部广播站我们真诚期待您的加入! 在线报名 在线留言 乘车路线 学校地图  咨询QQ-2:北京新华电脑学校欢迎您,我们将热情为您提供最专业的咨询服务
首页 >> 正文 权威认证介绍考证报考流程考证制度结业证办理流程考证证书规定考证模拟题下载考证模拟视频及考证注意事项CEAC奖学金
JS实现树形结构-类似于资源管理器
      2007年04月09日14:45  阅:

详情请点击:365国家紧缺型人才培养计划(简称365计划)【技能(TECHNOLOGY)+学历(COLLEGE)】教育(简称TC精英教育)权威认证

1、数据库  menu_s
   pid,parendid,name,link(说明,根类别 parentid=0 ,pid,为节点ID)
   1    0        中文   zw.asp
   2    0        英文   yw.asp
   3    1        中文1  zw1.asp
   4    1        中文2  zw2.asp
   5    2        英文1  ..
   5    2        英文2  ...
2、

  <%
  sql="select *,(select count(*) from menu_s where parent_id=0) as c from menu_s t where parent_id=0 order by pid"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,1 
  function a(parent_id)
    s=""
    sql="select *,(select count(*) from menu_s where parent_id=0) as c from menu_s t where parent_id="&parent_id&" and pid<>parent_id  order by pid"
    set rs1=server.createobject("adodb.recordset")
    rs1.open sql,conn,1,1
tn=n
jsn=rs1.recordcount
    do while not rs1.eof
  if rs1("c")>0 then
    s=rs1("c")
'onclick="onclick='show("&rs1("pid")&")'"
      else
    s="0"
        onclick=""
  end if
    if rs1.eof then
       
    l="<img src='图片' align=abstop  width ='18' height='18' vspace='2'  hspace='2'>"
      else
    l="<img src='小类图片' align=absmiddle width ='18' height='18' vspace='2'  hspace='2'>"
  end if
  rs1.movenext


  rs1.MovePrevious

  response.write "<table border=0 cellpadding=0 cellspacing=0 style='position:relative;left:13;font-size:12px;font-family:verdana;'><tr><td>"
  response.write l&"<span id='p"&rs1("pid")&"' class=dirclose>"
  if rs1("pid")="12" or rs1("pid")="13" or rs1("pid")="20" or rs1("pid")="9" or rs1("pid")="10"  or rs1("pid")="19"then
  response.write "<a href='../list/13.asp?name="&rs1("name")&"&id="&rs1("pid")&"'style='font-size:12px'><font color=#000000>"&"  "&rs1("name")&"</font></a>"
  else
  response.write "<a href='../list/one_test.asp?name="&rs1("name")&"&id="&rs1("pid")&"'style='font-size:12px'><font color=#000000>"&"  "&rs1("name")&"</font></a>"
      end if
  response.write "</span></td></tr>"
  if rs1("c")>0 then
    response.write "<tr style='display:none' id='c"&rs1("pid")&"'><td>"
    a(rs1("pid"))  
    response.write"</td></tr>"
  end if
  response.write"</table>"
  rs1.movenext
    loop

  end function
%>
<link href="main.css" rel="stylesheet" type="text/css">

<script>
  function show(aid){
    eval("document.all.c"+aid).style.display=(eval("document.all.c"+aid).style.display =='none')?'':'none';
   
  }
</script>
</head>

<body style='font-size:12px;margin-top:5'>
<div>

<%
do while not rs.eof
  if rs("c")>0 then
    s=rs("c")
onclick="onclick='show("&rs("pid")&")'"
      else
    s="0"
        onclick=""
  end if
   if rs.eof then

    l="<img src='images/b.gif' align=abstop width ='18' height='18' vspace='3'  hspace='3'>"
      else
    l="<img src='images/"&rs("pid")&".gif"&"' align=absmiddle width ='18' vspace='3'  hspace='3' height='18'>"
  end if
  rs.movenext
 
 
  rs.MovePrevious
  response.write "<table border=0 cellpadding=0 cellspacing=0 style='position:relative;left:13;font-size:12px;font-family:verdana;'><tr><td>"&l&"<span id='p"&rs("pid")&"' class=dirclose><a href='#' "&onclick&" style='font-size:12px'><font color=#000000>"&"  "&rs("name")&"</font></a></span></td></tr>"
  if rs("c")>0 then
    response.write "<tr style='display:none' id='c"&rs("pid")&"'><td>"
    a(rs("pid"))  
    response.write"</td></tr>"
  end if
  response.write"</table>"
  rs.movenext
  loop
%>

  

  上一条新闻:
  下一条新闻:
·成功新华人 ---more
     
  ·新华—电脑动漫艺术设计师专业
·新华—电脑环境装饰艺术设计专业
·新华—网站开发高级工程师专业..
·新华—网络技术高级工程师专业.
 
  ·TC精英教育(技能+学历教育)专业.

学院简介 | 专业设置 | 联系我们 | 乘车路线 | 学校地图 | 校园影吧 | 咨询邮箱| 校长信箱 | 网上报名 | 网上咨询 | 驻外招生办 | 郑重声明 | 高薪诚聘 | 友情链接

新华教育集团→北京新华电脑学校 学校地址: 北京市大兴区旧宫镇庑殿路18号(729公交总站向北300米) 北京新华电脑学校咨询电话: 010—67958088   咨询QQ: 88159900
版权所有 2005-2009 Copyright [www.bj-xinhua.com] All rights reserved 设计开发:北京新华电脑学校宣传办 站长信箱:hys_0202@163.com 备案号 京ICP备05076707号

备案号 京ICP备05076707号