javascript中如何写一个类似于目录结构的树,该如何写?

rocqin 2003-09-12 02:23:20
用到那些标签?,谢谢,小弟初学jsp,不太懂,望各位达人指教。
...全文
100 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
rocqin 2003-09-12
  • 打赏
  • 举报
回复
thanks dooluby(蓝色) & chenfei00()
dooluby 2003-09-12
  • 打赏
  • 举报
回复
to:thinkpad99(thinkpad99)
我的数型结构是用JavaScript写的,还有jsp和JavaScript是完全不一样的。
不知道你还要不要。
chenfei00 2003-09-12
  • 打赏
  • 举报
回复




<html>
<head>
<link href="inc/style.css" rel="stylesheet">
<title>树型目录</title>
</head>
<script language="JavaScript">
<!--
function view(obj,pic)
{
if (document.all[obj].style.display=="")
{
document.all[obj].style.display="none";
//alert("合并");
pic.all.tags('img')[0].src="images/icon-folder1-close.gif";
pic.all.tags('img')[1].src="images/icon_close.gif";
}
else
{
document.all[obj].style.display="";
//alert("打开");
pic.all.tags('img')[0].src="images/icon-folder1-open.gif";
pic.all.tags('img')[1].src="images/icon_open.gif";
}
}
//-->
</script>
<body>

<table OnClick="view('Label1',this)" height="16" border="0" cellpadding="0" cellspacing="1">
<tr>
<td><img src="images/icon-folder1-close.gif" width="15" height="13"><img src="images/icon_close.gif" width="16" height="16">厦门</td>
</tr>
</table>
<DIV id=Label1 style="display:none">
<table width="200" height="16" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">厦门1</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">厦门2</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">厦门3</font></td>
</tr>

</table>
</DIV>

<table OnClick="view('Label2',this)" height="16" border="0" cellpadding="0" cellspacing="1">
<tr>
<td><img src="images/icon-folder1-close.gif" width="15" height="13"><img src="images/icon_close.gif" width="16" height="16">福州</td>
</tr>
</table>
<DIV id=Label2 style="display:none">
<table width="200" height="16" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">福州1</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">福州2</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">福州3</font></td>
</tr>

</table>
</DIV>

<table OnClick="view('Label3',this)" height="16" border="0" cellpadding="0" cellspacing="1">
<tr>
<td><img src="images/icon-folder1-close.gif" width="15" height="13"><img src="images/icon_close.gif" width="16" height="16">广东</td>
</tr>
</table>
<DIV id=Label3 style="display:none">
<table width="200" height="16" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

</table>
</DIV>

<table OnClick="view('Label4',this)" height="16" border="0" cellpadding="0" cellspacing="1">
<tr>
<td><img src="images/icon-folder1-close.gif" width="15" height="13"><img src="images/icon_close.gif" width="16" height="16">北京</td>
</tr>
</table>
<DIV id=Label4 style="display:none">
<table width="200" height="16" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">北京1</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">北京2</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">北京3</font></td>
</tr>

<tr>
<td width="50" valign="top"><font color="#FF0000"><img src="images/blank.gif" width="50" height="16"></font></td>
<td height="16"><font color="#FF0000">北京4</font></td>
</tr>

</table>
</DIV>

</body>
</html>
thinkpad99 2003-09-12
  • 打赏
  • 举报
回复
再发这一份吧,lovertp@hotmail.com
dooluby 2003-09-12
  • 打赏
  • 举报
回复
发了。你去查收吧。guanpeng@vrlab.buaa.edu.cn
rocqin 2003-09-12
  • 打赏
  • 举报
回复
我收到信立即给分,实在是很急,周末我要用的。
再次谢谢了。
rocqin 2003-09-12
  • 打赏
  • 举报
回复
多谢楼上的,上面是我的邮箱。
rocqin 2003-09-12
  • 打赏
  • 举报
回复
guanpeng@vrlab.buaa.edu.cn
dooluby 2003-09-12
  • 打赏
  • 举报
回复
我有,代码好长,怎么给你??

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧