使用dtree構建架構導航

來源:互聯網
上載者:User

前言:

   該例子就是個架構導航 , 左邊包含dtree的架構,點擊上面的節點右邊架構顯示

說明步驟:

1. 首先獲得dtree  http://www.destroydrop.com/javascripts/tree/

2. 使用dtree 

2.1  匯入dtree.css dtree.js

 <link rel="StyleSheet" href="dtree.css" type="text/css"/> <script type="text/JavaScript" src="dtree.js"></script>

3. 關鍵代碼

3.1 大的架構代碼:

<frameset rows="20%,60%,20%">    <frame src="/hr/SystemManager/top.html">    <frameset cols="20%,80%">       <frame src="/hr/SystemManager/left.html" name="leftFrame" >       <frame src="/hr/SystemManager/right.html"  name="rightFrame" >    </frameset>      <frame src="/hr/SystemManager/foot.html"> </frameset>
3.1 dtree的代碼

<script type="text/javascript">        d = new dTree('d');                d.add(0,-1,'My example tree');        d.add(1,0,'Node 1','top.html');        d.add(2,0,'Node 2','top.html');        d.add(3,1,'Node 1.1','example01.html');        d.add(4,0,'Node 3','example01.html');        //d.add(5,3,'Node 1.1.1','top.html','top','  ','img/imgfloder.gif');        d.add(5,4,'1','/hr/failure.jsp','','parent.rightFrame');   //在mainFrame架構內顯        d.add(5,3,'點擊我','javascript:junploaction()',"",'');        document.write(d);</script><script>     function junploaction()     {        parent.rightFrame.location="left.html";     }</script>
更詳細的請看dtree.zip中的資料 希望對大家有所有小協助

圖片示範 :

點擊之後的圖片

dtree 遞迴思考:

dTree.prototype.selectCheckbox=function(nodeId){  var flag = 0;  var temp ;  var cs = document.getElementById("c"+this.obj+nodeId).checked;  var node = this.aNodes[nodeId];  var len =this.aNodes.length;  var same = [];  for (n=0; n<len; n++) {if(node.pid==this.aNodes[n].pid){same[same.length] = n;}   if ((this.aNodes[n].pid == node.id)) {        document.getElementById("c"+this.obj+n).checked=cs;flag = 1;this.selectCheckbox(n);   }  }  if(flag==0){    temp = n;//尋找同級節點//alert(same);for(j=0;j<same.length;j++){ document.getElementById("c"+this.obj+(same[j])).checked=true;}    //alert("終止"+this.aNodes[nodeId].name);  }






聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.