﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-小海贼的夜晚-随笔分类-Javascripts</title><link>http://www.blogjava.net/pirate/category/2336.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 09 Mar 2007 03:31:20 GMT</lastBuildDate><pubDate>Fri, 09 Mar 2007 03:31:20 GMT</pubDate><ttl>60</ttl><item><title>dtree example</title><link>http://www.blogjava.net/pirate/archive/2005/07/27/8534.html</link><dc:creator>海贼</dc:creator><author>海贼</author><pubDate>Wed, 27 Jul 2005 03:37:00 GMT</pubDate><guid>http://www.blogjava.net/pirate/archive/2005/07/27/8534.html</guid><wfw:comment>http://www.blogjava.net/pirate/comments/8534.html</wfw:comment><comments>http://www.blogjava.net/pirate/archive/2005/07/27/8534.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/pirate/comments/commentRss/8534.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/pirate/services/trackbacks/8534.html</trackback:ping><description><![CDATA[<P>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<A href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</A>"&gt;<BR>&lt;html&gt;<BR>&lt;head&gt;<BR>&nbsp;&lt;title&gt;Destroydrop &amp;raquo; Javascripts &amp;raquo; Tree&lt;/title&gt;<BR>&nbsp;&lt;link rel="StyleSheet" href="dtree.css" type="text/css" /&gt;<BR>&nbsp;&lt;script type="text/javascript" src="dtree.js"&gt;&lt;/script&gt;</P>
<P>&lt;/head&gt;<BR>&lt;body&gt;<BR>&lt;h1&gt;&lt;a href="/"&gt;Destroydrop&lt;/a&gt; &amp;raquo; &lt;a href="/javascripts/"&gt;Javascripts&lt;/a&gt; &amp;raquo; &lt;a href="/javascripts/tree/"&gt;Tree&lt;/a&gt;&lt;/h1&gt;</P>
<P>&lt;h2&gt;Example&lt;/h2&gt;<BR>&lt;div class="dtree"&gt;<BR>&nbsp;&lt;p&gt;&lt;a href="javascript: d.openAll();"&gt;open all&lt;/a&gt; | &lt;a href="javascript: d.closeAll();"&gt;close all&lt;/a&gt; | &lt;a href="javascript: d.openTo(4, true);"&gt;close all&lt;/a&gt;&lt;/p&gt;<BR>&nbsp;&lt;script type="text/javascript"&gt;<BR>&nbsp;&nbsp;&lt;!--</P>
<P>&nbsp;&nbsp;d = new dTree('d');<BR>&nbsp;&nbsp;d.config.target = "mytarget";<BR>&nbsp;&nbsp;d.config.folderLinks = false;</P>
<P>&nbsp;&nbsp;d.add(0,-1,'My example tree');<BR>&nbsp;&nbsp;d.add(1,0,'Node 1','example01.html','444444');<BR>&nbsp;&nbsp;d.add(2,0,'Node 2','example01.html');<BR>&nbsp;&nbsp;d.add(3,1,'Node 1.1','example01.html');<BR>&nbsp;&nbsp;d.add(4,0,'Node 3','example01.html');<BR>&nbsp;&nbsp;d.add(5,3,'Node 1.1.1','example01.html');<BR>&nbsp;&nbsp;d.add(6,5,'Node 1.1.1.1','example01.html');<BR>&nbsp;&nbsp;d.add(7,0,'Node 4','example01.html');<BR>&nbsp;&nbsp;d.add(8,1,'Node 1.2','example01.html');<BR>&nbsp;&nbsp;d.add(9,0,'My Pictures','example01.html','Pictures I\'ve taken over the years','','','img/imgfolder.gif');<BR>&nbsp;&nbsp;d.add(10,9,'The trip to Iceland','example01.html','Pictures of Gullfoss and Geysir');<BR>&nbsp;&nbsp;d.add(11,9,'Mom\'s birthday','example01.html');<BR>&nbsp;&nbsp;d.add(12,0,'Recycle Bin','example01.html','','','img/trash.gif');</P>
<P>&nbsp;&nbsp;document.write(d);</P>
<P>&nbsp;&nbsp;//--&gt;<BR>&nbsp;&lt;/script&gt;</P>
<P>&lt;/div&gt;<BR>&lt;p&gt;&lt;a href="mailto&amp;#58;drop&amp;#64;destroydrop&amp;#46;com"&gt;&amp;copy;2002-2003 Geir Landr&amp;ouml;&lt;/a&gt;&lt;/p&gt;<BR>&lt;/body&gt;</P>
<P>&lt;/html&gt;</P><img src ="http://www.blogjava.net/pirate/aggbug/8534.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/pirate/" target="_blank">海贼</a> 2005-07-27 11:37 <a href="http://www.blogjava.net/pirate/archive/2005/07/27/8534.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dtree api</title><link>http://www.blogjava.net/pirate/archive/2005/07/27/8532.html</link><dc:creator>海贼</dc:creator><author>海贼</author><pubDate>Wed, 27 Jul 2005 03:33:00 GMT</pubDate><guid>http://www.blogjava.net/pirate/archive/2005/07/27/8532.html</guid><wfw:comment>http://www.blogjava.net/pirate/comments/8532.html</wfw:comment><comments>http://www.blogjava.net/pirate/archive/2005/07/27/8532.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/pirate/comments/commentRss/8532.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/pirate/services/trackbacks/8532.html</trackback:ping><description><![CDATA[<H3>Functions</H3>
<DIV class=line></DIV>
<DIV class=item><A name=add></A>
<H4 class=func>add()</H4>
<P>Adds a node to the tree.<BR>Can only be called before the tree is drawn.</P>
<P>id, pid and name are required.</P>
<H4>Parameters</H4>
<TABLE class=files>
<TBODY>
<TR>
<TH>Name</TH>
<TH>Type</TH>
<TH>Description</TH></TR>
<TR>
<TD>id</TD>
<TD>Number</TD>
<TD>Unique identity number.</TD></TR>
<TR>
<TD>pid</TD>
<TD>Number</TD>
<TD>Number refering to the parent node. The value for the root node has to be -1.</TD></TR>
<TR>
<TD>name</TD>
<TD>String</TD>
<TD>Text label for the node.</TD></TR>
<TR>
<TD>url</TD>
<TD>String</TD>
<TD>Url for the node.</TD></TR>
<TR>
<TD>title</TD>
<TD>String</TD>
<TD>Title for the node.</TD></TR>
<TR>
<TD>target</TD>
<TD>String</TD>
<TD>Target for the node.</TD></TR>
<TR>
<TD>icon</TD>
<TD>String</TD>
<TD>Image file to use as the icon. Uses default if not specified.</TD></TR>
<TR>
<TD>iconOpen</TD>
<TD>String</TD>
<TD>Image file to use as the open icon. Uses default if not specified.</TD></TR>
<TR>
<TD>open</TD>
<TD>Boolean</TD>
<TD>Is the node open.</TD></TR></TBODY></TABLE><BR>
<H4>Example</H4>
<P><CODE>mytree.add(1, 0, 'My node', 'node.html', 'node title', 'mainframe', 'img/musicfolder.gif');</CODE></P><BR><A name=openall></A>
<H4 class=func>openAll()</H4>
<P>Opens all the nodes.<BR>Can be called before and after the tree is drawn.</P>
<H4>Example</H4>
<P><CODE>mytree.openAll();</CODE></P><BR><A name=closeall></A>
<H4 class=func>closeAll()</H4>
<P>Closes all the nodes.<BR>Can be called before and after the tree is drawn.</P>
<H4>Example</H4>
<P><CODE>mytree.closeAll();</CODE></P><BR><A name=opento></A>
<H4 class=func>openTo()</H4>
<P>Opens the tree to a certain node and can also select the node.<BR>Can only be called after the tree is drawn.</P>
<H4>Parameters</H4>
<TABLE class=files>
<TBODY>
<TR>
<TH>Name</TH>
<TH>Type</TH>
<TH>Description</TH></TR>
<TR>
<TD>id</TD>
<TD>Number</TD>
<TD>Identity number for the node.</TD></TR>
<TR>
<TD>select</TD>
<TD>Boolean</TD>
<TD>Should the node be selected.</TD></TR></TBODY></TABLE>
<H4>Example</H4>
<P><CODE>mytree.openTo(4, true);</CODE></P></DIV><A name=configuration></A>
<H3>Configuration</H3>
<DIV class=line></DIV>
<DIV class=item>
<TABLE class=files>
<TBODY>
<TR>
<TH>Variable</TH>
<TH>Type</TH>
<TH>Default</TH>
<TH>Description</TH></TR>
<TR>
<TD>target</TD>
<TD>String</TD>
<TD>true</TD>
<TD>Target for all the nodes.</TD></TR>
<TR>
<TD>folderLinks</TD>
<TD>Boolean</TD>
<TD>true</TD>
<TD>Should folders be links.</TD></TR>
<TR>
<TD>useSelection</TD>
<TD>Boolean</TD>
<TD>true</TD>
<TD>Nodes can be selected(highlighted).</TD></TR>
<TR>
<TD>useCookies</TD>
<TD>Boolean</TD>
<TD>true</TD>
<TD>The tree uses cookies to rember it's state.</TD></TR>
<TR>
<TD>useLines</TD>
<TD>Boolean</TD>
<TD>true</TD>
<TD>Tree is drawn with lines.</TD></TR>
<TR>
<TD>useIcons</TD>
<TD>Boolean</TD>
<TD>true</TD>
<TD>Tree is drawn with icons.</TD></TR>
<TR>
<TD>useStatusText</TD>
<TD>Boolean</TD>
<TD>false</TD>
<TD>Displays node names in the statusbar instead of the url.</TD></TR>
<TR>
<TD>closeSameLevel</TD>
<TD>Boolean</TD>
<TD>false</TD>
<TD>Only one node within a parent can be expanded at the same time. openAll() and closeAll() functions do not work when this is enabled.</TD></TR>
<TR>
<TD>inOrder</TD>
<TD>Boolean</TD>
<TD>false</TD>
<TD>If parent nodes are always added before children, setting this to true speeds up the tree.</TD></TR></TBODY></TABLE>
<H4>Example</H4>
<P><CODE>mytree.config.target = "mytarget";</CODE></P></DIV><img src ="http://www.blogjava.net/pirate/aggbug/8532.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/pirate/" target="_blank">海贼</a> 2005-07-27 11:33 <a href="http://www.blogjava.net/pirate/archive/2005/07/27/8532.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>