본문 바로가기
IT-개발,DB

[개발/javascript] 트리구조 폴더만들기

by SB리치퍼슨 2015. 3. 6.

트리구조 폴더만들기


윈도우즈 탐색기와 같은 트리구조의 폴더를 만듭니다.





----------------------------------------------------------------------------------------



<html>
<script language="JavaScript">
<!--



function list_view(divs, imgs) {  // 클릭여부에 폴더확장, 축소를 담당
var dspDiv = eval("document.all." + divs + ".style");
var dspImg = eval("document." + imgs);



if (dspDiv.display == "none") {
  dspImg.src = "openfolder.gif";
  dspDiv.display = "block";
} else {
  dspImg.src = "closedfolder.gif";
  dspDiv.display = "none";
}
}



-->
</script>



<body>



<div name="item1" style="cursor:hand" onclick="list_view('div1', 'img1')">
<table cellpadding=0 cellspacing=0 style="font-size:9pt; color:blue;">

<tr>
  <td><img name="img1" src="closedfolder.gif"></td>
  <td>사용하는 포털사이트</td>
</tr>
</table>
</div>



<div id="div1" style="display:none">
<table cellpadding=0 cellspacing=0 style="font-size:9pt;">
<tr>
  <td><img src="lastnode.gif"><img src="link.gif"></td>
  <td><a href="http://www.naver.com">네이버</a></td>
</tr>
</table>
</div>



<div name="item2" style="cursor;hand" onclick="list_view('div2', 'img2')">
<table cellpadding=0 cellspaciing=0 style="font-size:9pt; color:blue;">
<tr>
  <td><img name="img2" src="closedfolder.gif"></td>
  <td>그외 포털사이트</td>
</tr>
</table>
</div>



<div id="div2" style="display:none;">
<table border=0 cellpadding=0 cellspacing=0 style="font-size:9pt;">
<tr>
  <td><img src="node.gif"><img name="sub2_img1" src="link.gif"></td>
  <td width=100><a href="http://www.google.co.kr">구글</td>
</tr>
<tr>
  <td><img src="lastnode.gif"><img name="sub2_img2" src="link.gif"></td>
  <td width=100><a href="http://www.empas.com">엠파스</a></td>
</tr>
</table>
</div>



</body>
</html>





treefold.zip


반응형

댓글