사용방법.

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <link href="ytTree.css" rel="stylesheet" type="text/css">
  <script language="javascript" src="ytTree.js"></script>
<script>
var d = new ytTree("treeDiv"); // 트리  div명
function testF(){


 d.add(0,-1,'My example tree' ,"detail('2')");
 d.add(1,0,'1Node 1');
 d.add(3,1,'3Node 1.1');
 
 
 d.add(5,3,'5Node 1.1.1');
 d.add(6,5,'6Node 1.1.1.1',"detail('5')");
 d.add(14,3,'14Node 1.1.1',"detail('6')");
 d.add(15,14,'15Node 1.1.1',"detail('7')");
 d.add(16,14,'16Node 1.1.1',"detail('8')");
 
 d.add(2,0,'2Node 2',"detail('9')");
 
 d.add(4,0,'4Node 3',"detail('10')");
 d.add(7,0,'7Node 4',"detail('11')");
 
 d.add(9,0,'9My Pictures',"detail('12')",'Pictures I\'ve taken over the years','','img/cd.gif');
 
 d.add(10,9,'10The trip to Iceland',"detail('13')",'Pictures of Gullfoss and Geysir');
 d.add(11,9,'11Mom\'s birthday',"detail('14')");
 d.add(12,0,'12Recycle Bin',"detail('15')",'','','img/trash.gif');

 d.open();

}

function test5(){
 document.getElementById('treeDiv2').innerText = document.getElementById('treeDiv').outerHTML;
}

function detail(obj){
 //alert(obj)
}
var idAaa = 111;
function saveInfo(){

 d.addNode(idAaa,d.selectedNode.id ,document.getElementById('name').value,document.getElementById('url').value)

 idAaa ++;
}

function addTest(){
 d.add(17,11,'17Node 3',"detail('10')");
 d.add(18,17,'18Node 3',"detail('10')");
 d.add(19,17,'19Node 3',"detail('10')");
 d.add(20,17,'20Node 3',"detail('10')");
 
 //document.getElementById('treeDiv2').innerText = d.toString();
 d.open();
}

  </script>
 </HEAD>

 <BODY>
 <table border = "1" width ="800px;" height = "100%">
  <tr valign = "top">
   <td width = "400px">
  <input type = "button" value = "aaaa" onclick = "testF()">
 <input type = "text" id = "ccc">
 ||
 <input type = "button" value = "입력" onclick = "addTest()">
 ||
 <input type = "button" value = "소스" onclick = "test5()">
 
 <div id = "treeDiv" ></div>
 
 <br />

 <div id = "treeDiv2" >
   </td>
   <td width = "400px">
    노드명 <input type = "text" id = "name"> <br />
    링크 <input type = "text" id = "url"> <br />
    사용여부<input type = "text" id = ""> <br />
    팝업여부<input type = "text" id = "ccc"> <br />
    팝업여부<input type = "button" onclick = "saveInfo()" value = "저장"> <br />
   </td>
  </tr>
 </table>
 </BODY>
</HTML>

 

 </BODY>
</HTML>

트리 버그 수정. 정렬 가능하게 수정.
1

+ Recent posts