http://msdn.microsoft.com/library/shared/deeptree/xsl/deeptree.xsl

解决方案 »

  1.   

    孟大侠的网站,使用java script作的。
    http://xml.sz.luohuedu.net/xml/CoolMenu/main.htm
      

  2.   

    to  panyee(快乐王子):
    你发现了么?
      

  3.   

    to dahuzizyd(你就是我心中的女神):
    孟大侠的源代码我也看过了,还是不知道怎么实现定位的。
      

  4.   

    to panyee:
    这个角,n天以前(上一次散分之后的第二天还是第三天)就已经涨的了:)
    然后之后我就没有回答问题了,因为感觉水平不行
    -不会java,不会桌面应用程序的编程,不会……
    -努力充电中……
      

  5.   

    我有好几个版本的:
    -这个是斑竹moonpiazza做的:
    http://61.163.246.155/pro/XMLSelTree/Examples/Examples_02/default.htm
    -这个是csdn的:
    http://fason.nease.net/zhuanti/tree.htm

    http://fason.nease.net/zhuanti/tree/XML.zip
    -这个是fason做的一个数据库实现的:
    http://fason.nease.net/zhuanti/tree/deeptree_db.rar
    -msdn的:
    http://202.118.17.204/tree/deeptree_msdn.htc
    我都看了,都看不出怎么实现定位的,沾边是斑竹moonpiazza做的那个,不过只是实现了定位到第一个根节点的第一个字节点,
    然后是fason做的服务器版本的那个,不过我发现他是用iframe来实现的,感觉上如果采用他的话还有很多东西要改,
    fason实现定位是用这个文件里面的函数:http://202.118.17.204/tree/dtree.js------------------------
    所谓定位就是这种效果:
    http://www.ceocio.net/fason/deeptree/deeptree.asp?url=http://msdn.microsoft.com/library/
      

  6.   

    使用 层 + javascript 应该 可以吧 或者 xml+ xslt
      

  7.   

    to redbb(dotneter):
    难在怎么定位啊
    55555555555555555
      

  8.   

    to panyee:
    我整理发到你的邮箱里面了,谢谢
      

  9.   

    如 <xsl:when test="@Target">
    - <xsl:attribute name="target">
      <xsl:value-of select="@Target" /> 
      </xsl:attribute>使用 xslt 进行 判断 , 使用 xpath 定位
      

  10.   

    你 需要 看看   xml 高级 编程 一书
      

  11.   

    haha,用flash+xml或随便什么格式文件
    很好搞定的
      

  12.   

    http://www.ceocio.net/fason/deeptree/deeptree.asp?url=http://msdn.microsoft.com/library/上面这个网址, 它在iframe中调用一个构造出来的新的url,
    直接从http://www.ceocio.net/fason/deeptree/deeptree.asp那得到一串的html代码,类似于:<tr id=Node4>
    <td class=Node noWrap><img id=img4 onclick=Ligth(this.nextSibling) src="http://www.ceocio.net/fason/deepttree/image/node.gif" align=absMiddle><span class="" onmousedown=Light(this) id=treeNode4 onmouseover=doOver(this) title=常见技巧 onmouseout=doOut(this) target="_blank" href="http://fason.nease.net/code/still.htm">常见技巧</span><iframe id=syncIfame4 style="display:none" name=syncIfrm4 src="about:blank" frameBorder=0 width=0 height=0></iframe></td></tr>我想它是通过父id和url直接查询出来,组成一个html串给客户端
    Light函数是用于打开新窗口的:
    它通过Ligth(this.nextSibling)取得this.nextSibling参数就是<span ...></span>
    主要参数是:
    title=常见技巧 target="_blank" href="http://fason.nease.net/code/still.htmfunction Light(o){
    if(!tem)tem=o
    tem.className=''
    o.className='NodeFocus'
    tem=o
    var href=o.getAttribute("href")
    var target=o.getAttribute("target")
    if(href!="")window.open(href,target)
    /*
    这里可灵活运用,target可以是表内的另一属性,这里默认_blank
    */
    }
    <span>里带上了href, target参数, 用于在指定窗口打开网址
    msdn网站上的采用xml+xsl来动态生成html代码, xml结构类似于这个:
    <Tree>
    <TreeNode NodeImgSrc="..." NodeId="..." Title="..." Href="..." Target="..." 
    NodeXmlSrc="...">
    </Tree>
    它里头带了Href和Target参数, deeptree.xsl中对xml进行解析:<xsl:choose>
            <xsl:when test="@Href">
              <a>
                <xsl:choose>
                    <xsl:when test="@Target">
                        <xsl:attribute name="target"><xsl:value-of select="@Target" /></xsl:attribute>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:attribute name="target">fraContent</xsl:attribute>
                    </xsl:otherwise>
                </xsl:choose>
                <xsl:attribute name="tabindex">-1</xsl:attribute>
                <xsl:attribute name="href"><xsl:value-of select="@Href" /></xsl:attribute>
                <xsl:value-of select="@Title" />
              </a>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="@Title" />
            </xsl:otherwise>
          </xsl:choose>有target就在指定的框架中打开url, 没有指定就在fraContent框架中打开我想它大致就是这么个流程
      

  13.   

    deeptree.xml例子, 把它和deeptree.xsl放在同一目录, 打开看看<?xml version="1.0" ?>
    <?xml-stylesheet type="text/xsl" href="deeptree.xsl"?>
    <Tree>
      <TreeNode NodeImgSrc="http://www.ceocio.net/fason/deeptree/image/node.gif" NodeId="1" Title="网易网站" Href="http://www.163.com" Target="_blank" >
      </TreeNode>
      <TreeNode NodeImgSrc="http://www.ceocio.net/fason/deeptree/image/node.gif" NodeId="2" Title="新浪网站" Href="http://www.sina.com.cn" Target="_self">
      </TreeNode>
      <TreeNode NodeImgSrc="http://www.ceocio.net/fason/deeptree/image/expand.gif" NodeId="3" Title="我的目录" 
    Href="#" NdeXmlSrc="deeptree2.xml">
      </TreeNode>
    </Tree>
      

  14.   

    我也来了, 不知你调试出来了没有?另:deeptreeconfig.xml中配置文件的参数含义你是否知道?
      

  15.   

    知道啊,我就差一点了
    现在我能展开任意一个根结点,就是展开子节点老是有问题,
    我用getElementById();找到的对象总是为空,可是我用alert(document.body.innerHTML),看的时候这个对象明明是有的,
    这是一个span对象
      

  16.   

    采用http://www.ceocio.net/fason/deeptree/deeptree.asp?url=http://msdn.microsoft.com/library/
    的是吗? 直接输出html代码?
    取得为空是不是把结点都套在<form>里了?
      

  17.   

    不,我用的是msdn那个的
    因为我的xml文件都是静态的
      

  18.   

    msdn的htc取节点是这个吧?
    function GetHtmlElement(objParent,strChildTagName,strType)
    改一改它
      

  19.   

    flash为什么不可取呢?用代码作图始终做不出更好的效果了,flash的效果可以做的更好,而且我觉得把flash和.net结合将是未来的主流,千万不要小看flash
      

  20.   

    你一定是一个flash高手但是flash内置有xml解析器么?
      

  21.   

    to panyee(快乐王子) 
    我发现msdn可能也因为用getElementById();不行才会在GetHtmlElement函数里
    用循环来解决
      

  22.   

    to zhouxsilenthill(月下的夜想曲):
    你是不是做过?
    能不能发到

    谢谢
      

  23.   

    不知道为什么,我获得了第一个根结点的子节点之后,再想获得这个子节点的子节点,就不行了
    比如说这种节点是
    -1
     -1.1
      -1.1.1
    这种形式,
    我用
    var urlParam=window.location.search.substring(1);
        var urlParams=window.location.search.substring(1).split("&");
        vId=urlParams[0].substring(urlParams[0].indexOf("=")+1);
        bId=urlParams[1].substring(urlParams[1].indexOf("=")+1);
        //
        
        var objXMLDoc_Child = new ActiveXObject("Microsoft.XMLDOM");
        objXMLDoc_Child.async = false;
        objXMLDoc_Child.load("1/top.xml");
        var root=objXMLDoc_Child.ducumentElement;
       
       var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    xmlDoc.load("1/top.xml");
    var root=xmlDoc.documentElement;
    var nodeList;

    nodeList=xmlDoc.getElementsByTagName("TreeNode");
    var fileBoard;//板块
    for(i=0;i<nodeList.length;i++)
    {
    if("infoplat"+vId==nodeList.item(i).getAttribute("NodeId"))
    {
    fileBoard=nodeList.item(i).getAttribute("NodeXmlSrc");
    break;
    }
    }
       node=top.document.getElementById("infoplat"+vId);
       ExpandNode(node.parentElement);
    这些语句获得节点1.1,然后我想用一个循环获得所有的字节点,根据id找到我想要的节点:
    var spans=node.parentElement.getElementsByTagName("SPAN");
       var boardNode=null;
      
       for(i=0;i<spans.length;i++)
       {
       alert(spans[i].id);
       if(spans[i].id.toString()=="infoplat100")
       {
       boardNode=spans[i];
       alert("dddddddddd");
                break;
       }
    }
    加上了alert("可以是任意的文本");是可以获得的,而且不单是alert,confirm也好用,
    但是去掉了弹出对话框的语句之后我发现spans.length竟然是0!这是为什么呢?
      

  24.   

    alert,confirm这一类的对话框能产生什么作用呢?
      

  25.   

    还有现在我发现,如果这些语句不是写在onload函数里,而是写在oncontextmenu事件的处理代码里面,又是好用的;我想是因为没有加载完相应的xml文件所致,
    问题是我应该把代码写在那里面呢,总不能等到用户点击一下才能看到展开的菜单吧?
      

  26.   

    特别感谢 panyee(快乐王子) 、 redbb(dotneter)