javascript中如何写一个类似于目录结构的树,该如何写? 发了。你去查收吧。[email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 再发这一份吧,[email protected] <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> to:thinkpad99(thinkpad99)我的数型结构是用JavaScript写的,还有jsp和JavaScript是完全不一样的。不知道你还要不要。 thanks dooluby(蓝色) & chenfei00() 一模一样的程序却不同的命运 FCK编辑完源代码提交时会自动转义"&"有没有地方取消啊 500错误 怎么解决 tomcat5.5.9如何设置虚拟目录 spring整合hibernate出错 在JSP 里怎样给数据库密码加密 急!!!!! session 小问题在线等候 求网站计数器代码(急,在线等待,谢谢) 在apache(unix)服务器下的web用jsp?or php 请问怎样弹出像提问这样的没有菜单的窗口,jsp怎样实现? jsp中使用java类的问题 高分征求高手的解决方案 紧急 在线等待
<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>
我的数型结构是用JavaScript写的,还有jsp和JavaScript是完全不一样的。
不知道你还要不要。