动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ ASP技巧 ]的信息

本月文章推荐
.网页加速处理-页面减肥与减化.
.一个简单的asp数据库操作类.
.ASP提高数据显示效率-缓存探幽.
.用Asp获取Dll加密新闻内容.
.返回UPDATE SQL语句所影响的行数.
.提高ASP性能的最佳选择(续四).
.在ASP.NET中使用.NET组件.
.利用Session限制重复操作的简单方.
.取出所有的传递参数短方法.
.ASP读取XML数据文件的方法.
.用ASP+DLL实现WEB方式修改服务器.
.如何从数据库得到一个列表表单.
.生成一个不重复的随即数字.
.采用XML数据来填充ASP表单.
.样设置为使用OLEDB连接我的Acces.
.检查来访IP是否合法的实际应用.
.不用组件实现上载功能(2).
.关于ASP,ASP.NET,VB.NET里的MD5加.
.remote script文档(转载自微软)(.
.提供一种“间接防止另存为”的方.

Dom遍历XML的一个例子,结果为树状结构

发表日期:2001-3-28 |


knowledge.XML文件

<?xml version="1.0" encoding="gb2312"?>
<?xml:stylesheet type="text/xsl" href="knowledge.xsl"?>
<Ebaihe name="Ebaihe" type="gs" id="gs000">
<知识管理 name="知识管理" type="rt" id="rt000">
  <目录 name="vc++" type="ml" id="ml003"/>
  <目录 name="asp" type="ml" id="ml001">
     <知识 name="什么是ASP 1" type="zs" id="zs001">
        <title>什么是ASP</title>
        <author>cxx</author>
        <adddate>2001-02-20</adddate>
        <content>ASP:Active Server Page</content>
     </知识>
     <知识 name="什么是ASP 2" type="zs" id="zs002">
        <title>什么是ASP</title>
        <author>cxx</author>
        <adddate>2001-02-20</adddate>
        <content>ASP:Active Server Page</content>
     </知识>
  </目录>
  <目录 name="vbs" type="ml" id="ml002">
     <知识 name="什么是vbs 1" type="zs" id="zs003">
        <title>什么是ASP</title>
        <author>cxx</author>
        <adddate>2001-02-20</adddate>
        <content>ASP:Active Server Page</content>
     </知识>
     <知识 name="什么是vbs 2" type="zs" id="zs004">
        <title>什么是ASP</title>
        <author>cxx</author>
        <adddate>2001-02-20</adddate>
        <content>ASP:Active Server Page</content>
     </知识>
  </目录>
</知识管理>
<留言簿 name="留言簿" type="ly" id="ly000">
  <单元 name="你好" type="dy" id="dy001">
     <留言 name="Who are you" type="zs" id="zs005">
        <title>什么是ASP</title>
        <author>cxx</author>
        <adddate>2001-02-20</adddate>
        <content>ASP:Active Server Page</content>
     </留言>
     <留言 name="你好" type="zs" id="zs006">
        <title>什么是ASP</title>
        <author>cxx</author>
        <adddate>2001-02-20</adddate>
        <content>ASP:Active Server Page</content>
     </留言>
  </单元>
  <单元 name="我的留言" type="dy" id="dy003"/>
</留言簿>
<留言簿 name="留言簿" type="ly" id="ly001"/>
</Ebaihe>

bianli.asp文件

<% @LANGUAGE=VBScript%>
<%
function getimgstr(ttid,ttname,ttlvl,tttype,ttlf,ttlstr)
   dim ttstr1
   if ttlvl=0 then
         ttstr1=ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" & chr(34) & "call OnClickDiv('" & ttid & "','" & "2" & "')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1= ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
         ttstr1= ttstr1 & "image/Computer.gif" & chr(34) & " height=16>" & "</a>"
         ttstr1=ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" & chr(34) & "call OnClickDiv('" & ttid & "','" & "2" & "')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1=ttstr1 & ttname & "</a><br>" & vbcrlf
         ttstr1=ttstr1 & "<div id=" & chr(34) & ttid & chr(34) & " style=display:none>" & vbcrlf
   else
      for i= 2 to len(ttlstr)-1
         if mid(ttlstr,i,1)="1" then
            ttstr1 = ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
            ttstr1 = ttstr1 & "image/I-line.gif" & chr(34) & " height=16>"
         end if
         if mid(ttlstr,i,1)="0" then
            ttstr1 = ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
            ttstr1 = ttstr1 & "image/none.gif" & chr(34) & " height=16>"
         end if
      next
      if tttype=1 then
         ttstr1= ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" & chr(34) & "call OnClickDiv('" & ttid & "','" & ttlf & "')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1=ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
         if ttlf=0 then
            ttstr1= ttstr1 & "image/T-plus.gif" & chr(34) & " id=" & chr(34) & "l-" & ttid & chr(34) & "
height=16></a>"
         else
            ttstr1= ttstr1 & "image/l-plus.gif" & chr(34) & " id=" & chr(34) & "l-" & ttid & chr(34) & "
height=16></a>"
         end if
         ttstr1= ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" & chr(34) & "call OnClickDiv('" & ttid & "','" & ttlf & "')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1=ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
         ttstr1= ttstr1 & "image/c-fold.bmp" & chr(34) & " id=" & chr(34) & "p-" & ttid & chr(34) & "
height=16></a>"
         ttstr1= ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" &chr(34) & "call OnClickDiv('" & ttid & "','" & ttlf & "')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1=ttstr1 & ttname & "</a><br>" & vbcrlf
         ttstr1=ttstr1 & "<div id=" & chr(34) & ttid & chr(34) & " style=display:none>" & vbcrlf
      else
         ttstr1 = ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
         if ttlf=0 then
            ttstr1 = ttstr1 & "image/t-line.gif" & chr(34) & " height=16>"
         else
            ttstr1 = ttstr1 & "image/l-line.gif" & chr(34) & " height=16>"
         end if
         ttstr1= ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" & chr(34) & "call OnClickDiv('" & ttid & "','3')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1=ttstr1 & "<img border=" & chr(34) & "0" & chr(34) & " src=" & chr(34)
         ttstr1= ttstr1 & "image/leaf.bmp " & chr(34) & " id=" & chr(34) & "p-" & ttid & chr(34) & "
height=16></a>"
         ttstr1= ttstr1 & "<a href=" & chr(34) & "#" & chr(34)
         ttstr1=ttstr1 & " onclick=" & chr(34) & "call OnClickDiv('" & ttid & "','3')"
         ttstr1=ttstr1 & chr(34) & ">"
         ttstr1=ttstr1 & ttname & "</a><br>" & vbcrlf
         ttstr1=ttstr1 & "<div id=" & chr(34) & ttid & chr(34) & " style=display:none></div>" & vbcrlf
      end if
   end if
   getimgstr=ttstr1
end function
Function ShowNode(node,mylvl,myleaf,mylstr)
   dim ttstr
   dim mystr
   dim ttleaf
   dim ttn
   ttn=0
   if myleaf=0 then
      ttleaf=0
   else
      ttleaf=1
   end if
For Each child In node.childNodes
    ttn=ttn+1
    If (child.nodeType=1) Then
       nod_name=child.Attributes.getnamedItem("name").Text
       nod_type=child.Attributes.getnamedItem("type").Text
       nod_id=child.Attributes.getnamedItem("id").Text
       if nod_type<>"zs" then
          If (child.hasChildNodes) Then
             if ttn=node.childnodes.length then
                mystr=mystr & getimgstr(nod_id,nod_name,mylvl,1,1,mylstr & "0")
                ttstr=ShowNode(child,mylvl+1,1,mylstr & "0")
             else
                mystr=mystr & getimgstr(nod_id,nod_name,mylvl,1,0,mylstr & "1")
                ttstr=ShowNode(child,mylvl+1,0,mylstr & "1")
             end if
             mystr=mystr & ttstr
             mystr=mystr & "</div>"
          else
             if ttn=node.childnodes.length then
                mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,1,mylstr & "0")
             else
                mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,0,mylstr & "1")
             end if
          End If
       else
          if ttn=node.childnodes.length then
             mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,1,mylstr & "0")
          else
             mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,0,mylstr & "1")
          end if
       end if
    end if
Next
ShowNode=mystr
End Function
  dim xmldoc
  dim xmlstr
  Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
  xmldoc.async=false
  xmldoc.load(Server.MapPath("knowledge.xml"))
  xmlstr=ShowNode(xmldoc,0,0,"")
'  set xmldoc=nothing
'parent.results.display(source.transformNode(style));
%>
<html>

<head>
</head>

<body>
<script language="VBScript">

dim olditem

sub OnClickDiv(DivId,pType)
   if (document.all(DivId).style.display="none") then
      document.all(DivId).style.display=""
      if (pType="0") then
        document.all("l-"+DivId).src="image/t-minus.gif"
        document.all("p-"+DivId).src="image/o-fold.bmp"
      end if
      if (pType="1") then
        document.all("l-"+DivId).src="image/l-minus.gif"
        document.all("p-"+DivId).src="image/o-fold.bmp"
      end if
      'if (pType="3") then
      '  document.all("p-"+DivId).src="image/o-fold.bmp"
      'end if
   else
      document.all(DivId).style.display="none"
      if (pType="0") then
        document.all("l-"+DivId).src="image/t-plus.gif"
        document.all("p-"+DivId).src="image/c-fold.bmp"
      end if
      if (pType="1") then
         document.all("l-"+DivId).src="image/l-plus.gif"
         document.all("p-"+DivId).src="image/c-fold.bmp"
      end if
      'if (pType="3") then
      '  document.all("p-"+DivId).src="image/c-fold.bmp"
      'end if
    end if
end sub
</script>
<font name="宋体" size="2">
<nobr><%=xmlstr%></nobr></font>
</body>


上一篇:如何使用context()方法将数据置入表格(XML) 人气:9236
下一篇:利用ASP从远程服务器上接收XML数据 人气:9766
浏览全部的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-8-21 Nucleus v3.33 多国语言版
2008-8-21 HDWiki v4.0 bulid 080821 UTF-8
2008-8-21 明科在线客服系统 v6.0
2008-8-21 KesionCMS v5.0.2 正式版 utf-8
2008-8-21 KesionEshop v5.0.2 正式版 utf-8
2008-8-21 HDWiki v4.0 bulid 080821 GBK
2008-8-21 新文互动酷站展示系统 v1.5
2008-8-21 Punbb v1.2.20 多国语言版
2008-8-21 QQ头像网 beta
2008-8-16 iLaba Player(小喇叭播放器) v2.
2008-8-16 DoubleClickFix 鼠标双击修正工具
2008-8-16 CrystalCPUID 4.15.2.451
2008-8-16 VeryCD 电驴(easyMule) 1.0.4 Bu
2008-8-16 uTorrent 1.8 Build 11813 - Sta
2008-8-16 比特精灵(BitSpirit) v3.3.2.287
2008-8-16 StayInTune音叉 v1.0 破解版
2008-8-16 iChing《周易》汉化补丁 v1.0
2008-8-16 Starmap星空图v1.0汉化破解版
  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号