Xtree

6855 단어 htmlC++ccssC#
http://sxpujs.iteye.com/blog/456876
http://hi.baidu.com/jackywdx/blog/item/b970bbf9b3b7cb5c242df247.html

   1.                           ,   
   2. dTree(http://www.destroydrop.com/javascripts/tree/)   
   3. dTree      javascript    ,    ie5+, ns 6+, Opera 7+  Mozilla      
   4.     :   
   5.    ,  head   dtree.js dtree.css(    js,css img      ),     :   
   6. <link rel="StyleSheet" href="dtree.css" type="text/css" />  
   7. <script type="text/javascript" src="dtree.js"></script>  
   8.           
   9. <div class="dtree">  
  10.   
  11.     <p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>  
  12.   
  13.     <script type="text/javascript">  
  14.          <!--   
  15.   
  16.         d = new dTree('d');   
  17.   
  18.          d.add(0,-1,'My example tree');   
  19.          d.add(1,0,'Node 1','example01.html');   
  20.          d.add(2,0,'Node 2','example01.html');   
  21.          d.add(3,1,'Node 1.1','example01.html');   
  22.          d.add(4,0,'Node 3','example01.html');   
  23.          d.add(5,3,'Node 1.1.1','example01.html');   
  24.          d.add(6,5,'Node 1.1.1.1','example01.html');   
  25.          d.add(7,0,'Node 4','example01.html');   
  26.          d.add(8,1,'Node 1.2','example01.html');   
  27.          d.add(9,0,'My Pictures','example01.html','Pictures I\'ve taken over the years','','','img/imgfolder.gif');   
  28.          d.add(10,9,'The trip to Iceland','example01.html','Pictures of Gullfoss and Geysir');   
  29.          d.add(11,9,'Mom\'s birthday','example01.html');   
  30.          d.add(12,0,'Recycle Bin','example01.html','','','img/trash.gif');   
  31.          d.add(13,12,'sub Recycle Bin','','','','img/trash.gif');   
  32.   
  33.          document.write(d);   
  34.   
  35.          //-->  
  36.     </script>  
  37.   
  38. </div>  
  39. add        id:      , pid:     , name:      , url:             , title:   ,   
  40. target:         , icon:        , iconOpen:        , open:       , true  , false  (     cookie,          )   
  41. dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open)   
  42.   
  43. Xtree(http://webfx.eae.net/dhtml/xtree/implementation.html)   
  44.   dTree  , xTree      ,             
  45.    :   
  46. <!-- The xtree script file -->  
  47. <script src="xtree.js"></script>  
  48. <link type="text/css" rel="stylesheet" href="xtree.css">  
  49.     ,       
  50. <div style="position: absolute; width: 200px; top: 0px; left: 0px; height: 100%; padding: 5px; overflow: auto;">  
  51.   
  52. <!-- js file containing the tree content, edit this file to alter the menu,   
  53.       the menu will be inserted where this tag is located in the document -->  
  54. <script>  
  55. if (document.getElementById) {   
  56.      var tree = new WebFXTree('Root');   
  57.      tree.setBehavior('classic');   
  58.      var a = new WebFXTreeItem('1');   
  59.      tree.add(a);   
  60.      var b = new WebFXTreeItem('1.1');   
  61.      a.add(b);   
  62.      b.add(new WebFXTreeItem('1.1.1'));   
  63.      b.add(new WebFXTreeItem('1.1.2'));   
  64.      b.add(new WebFXTreeItem('1.1.3'));   
  65.      var f = new WebFXTreeItem('1.1.4');   
  66.      b.add(f);   
  67.      f.add(new WebFXTreeItem('1.1.4.1'));   
  68.      f.add(new WebFXTreeItem('1.1.4.2'));   
  69.      f.add(new WebFXTreeItem('1.1.4.3'));   
  70.      var c = new WebFXTreeItem('1.2');   
  71.      a.add(c);   
  72.      c.add(new WebFXTreeItem('1.5.1'));   
  73.      c.add(new WebFXTreeItem('1.5.2'));   
  74.      c.add(new WebFXTreeItem('1.5.3'));   
  75.      a.add(new WebFXTreeItem('1.3'));   
  76.      a.add(new WebFXTreeItem('1.4'));   
  77.      a.add(new WebFXTreeItem('1.5'));   
  78.      var d = new WebFXTreeItem('2');   
  79.      tree.add(d);   
  80.      var e = new WebFXTreeItem('2.1');   
  81.      d.add(e);   
  82.      e.add(new WebFXTreeItem('2.1.1'));   
  83.      e.add(new WebFXTreeItem('2.1.2'));   
  84.      e.add(new WebFXTreeItem('2.1.3'));   
  85.      d.add(new WebFXTreeItem('2.2'));   
  86.      d.add(new WebFXTreeItem('2.3'));   
  87.      d.add(new WebFXTreeItem('2.4'));   
  88.      document.write(tree);   
  89. }   
  90.   
  91. function addNode() {   
  92.      if (tree.getSelected()) {   
  93.          tree.getSelected().add(new WebFXTreeItem('New'));   
  94.      }   
  95. }   
  96.   
  97. function addNodes() {   
  98.      if (tree.getSelected()) {   
  99.          var foo = tree.getSelected().add(new WebFXTreeItem('New'));   
 100.          var bar = foo.add(new WebFXTreeItem('Sub 1'));   
 101.          var fbr = foo.add(new WebFXTreeItem('Sub 2'));   
 102.      }   
 103. }   
 104.   
 105. function delNode() {   
 106.      if (tree.getSelected()) {   
 107.          tree.getSelected().remove();   
 108.      }   
 109. }   
 110. </script>  
 111.   
 112. </div>  
 113.   
 114.       :tree.toggle()   
 115.     :tree.expand();   
 116.     :tree.collapse();   
 117.       :tree.expandAll();   
 118.       :tree.collapseAll();   
 119.      :tree.expandChildren();   
 120.      :tree.collapseChildren();   
 121.        id:if (tree.getSelected()) { alert(tree.getSelected().id); }   
 122.     :addNode()   
 123.       :addNodes()   
 124.     :delNode()   


좋은 웹페이지 즐겨찾기