js如何实现目录树形展开收缩效果(1)

<!DOCTYPE HTML>
<html>
<head>
<script language="javascript">
 function change(x,y)
  {
    if(x.style.display=="none")  //展开树形的子节点
     {
       x.style.display="";
       y.src="jian.jpg";
     }
     else if(x.style.display=="") //收缩树形的子节点
      {
       x.style.display="none";
       y.src="jia.jpg";
      }


  }
</script>
</head>




<body>
<table width="175" height="28" border="0"  cellpadding="0" cellspacing="4" onclick="change(tz1,img_tz1)" style="cursor:hand">
  <tr>
    <td> <img  name="img_tz1" src="jia.jpg">&nbsp;编程词典管理</div></td>
  </tr>
</table>
<table id="tz1" style="display:none">
    <tr>
    <td width="40" height="24" >&nbsp;</td>
    <td width="114" ><div align="left">添加编程词典版本</div></td>
  </tr>
  <tr>
    <td height="24" >&nbsp;</td>
    <td height="20" ><div align="left">编辑编程词典版本</div></td>
  </tr>
</table>
</body>
</html>

你可能感兴趣的:(JavaScript,html,css,目录)