<Link the rel = "the StyleSheet" the href = "CSS / dtree.css" type = "text / CSS" />
<Script type = "text / JavaScript" the src = "JS / dtree.js"> </ Script>
must refer the two documents.
Node spanning tree code:
<Script type = "text / JavaScript">
<-!
D = new new dTree ( 'D'); // Create a tree object
d.add (0, -1, 'My example tree' ); // Create a tree object
d.add (1,0, 'the Node. 1', 'example01.html');
d.add (2,0, 'the Node 2', 'example01.html');
D. the Add (3,1, 'the Node 1.1', 'example01.html');
d.add (4,0, 'the Node. 3', 'example01.html');
d.add (5,3, 'the Node 1.1. . 1 ',' example01.html ');
d.add (6,5,' the Node 1.1.1.1 ',' example01.html ');
d.add (7,0,
d.add (8,1, 'the Node 1.2', 'example01.html');
d.add (9,0, 'My Pictures',' example01.html ',' the I Pictures \ 'The VE taken over years' , '', '', 'IMG / imgfolder.gif');
d.add (10,9, 'to Iceland of The TRIP', 'example01.html', 'Pictures of Gullfoss and Geysir');
d.add ( 11,9, 'Mom \' S Birthday ',' example01.html ');
d.add (12,0,' the Recycle the Bin ',' example01.html ',' ',' ',' IMG / trash.gif ');
document.write (D);
// ->
</ Script>
d.add (0, -1,' My Example tree ');
this adds a root node of a tree, the display name as' My example tree '
d.add (1,0, 'Node 1' , 'example01.html');
this tree below a root node adds a child node. (Specific Parameter Meaning d.add () methods can be found api.html files)
Commonly used:
first parameter represents the node ID of the current
second parameter indicates the ID of the parent node of the current node, the root node is -1
text third parameter, the node to display
a fourth parameter, nodes the Url
fifth parameter, Title node when the mouse moves to the node
sixth parameter, target node
seventh parameter, node icons used, use the default icon when the node is not specified
eighth argument, used open the node icon, the icon specified node is not used when the default values
ninth parameter to determine whether to open the node
add ()
to add a node to the tree
only be called before the tree is created.
must id, pid, name
parameter
name type description
id number unique ID number
pid number determined number of the parent node, root node is -1
text label name String node
Url url String node
title title String node
target target String node
icon String node icon used, node does not use the default value specified icon
iconOpen String used to open a node icon, the icon is not specified using the node Default
open Boolean node determines whether to open
the example
mytree.add (1, 0, 'My node', 'node.html', 'node title', 'mainframe ',' IMG / musicfolder.gif ');
openAll ()
to open all the nodes
may be invoked before or after the tree is created.
examples
mytree.openAll ();
closeAll ()
Close all nodes
can be invoked before or after the tree is created.
examples
mytree.closeAll ();
openTo ()
. Certain website Opens the tree to node a and node the SELECT CAN Also
called only after the tree has been created ..
parameter
name type description
unique ID number of the node id number
select Boolean determining whether the node is selected
examples
mytree.openTo (4, true);
configuration
variable type description default value
target target String true for all nodes
folderLinks Boolean true folder can be linked
useSelection Boolean true node can be selected (highlighted)
UseCookies Boolean to true tree may use cookies to remember the state
tree useLines Boolean true to create a strip line
useIcons Boolean true icon created with tree
useStatusText Boolean false display node name replaced node url status bar
closeSameLevel Boolean false only a parent node may be expanded when the function is available openAll () and closeAll () function is not available
inOrder Boolean false if parent nodes are always added before the child nodes, this parameter can be used to accelerate the menu display.
examples
mytree.config.target = "mytarget";
Reproduced in: https: //my.oschina.net/u/2260184/blog/540554