日期:2014-05-16  浏览次数:20382 次

动态从取数据生成下面的表怎么实现像树一样的折叠效果
<table id="tblKeywords" border="0">
<tr>
<td class="indent_0"><span class="iconBtn"></span><div>关键词组</div></td><td></td>
</tr><tr>
<td class="indent_1"><span class="iconBtn"></span><div>关键词一</div></td><td><input id="ctl25" type="checkbox" name="ctl25" /><label for="ctl25">新建关键词</label><input id="ctl26" type="checkbox" name="ctl26" /><label for="ctl26">新建关键词 2</label><input id="ctl27" type="checkbox" name="ctl27" /><label for="ctl27">新建关键词 3</label></td>
</tr><tr>
<td class="indent_2"><span class="iconBtn"></span><div>关键词三</div></td><td><input id="ctl30" type="checkbox" name="ctl30" checked="checked" /><label for="ctl30">key</label></td>
</tr><tr>
<td class="indent_1"><span class="iconBtn"></span><div>关键词二</div></td><td><input id="ctl33" type="checkbox" name="ctl33" /><label for="ctl33">keyword</label><input id="ctl34" type="checkbox" name="ctl34" checked="checked" /><label for="ctl34">key</label></td>
</tr><tr>
<td class="indent_2"><span class="iconBtn"></span><div>AAA</div></td><td></td>
</tr>
</table>

------解决方案--------------------
<table id="tblKeywords" border="0">
<tr> 
<td class="indent_0"> <span class="iconBtn"> </span> <div onclick="if(xxx.style.display=='none'){xxx.style.display=='block'}else{xxx.style.display=='none'}"> 关键词组 </div> </td> <td> </td> 
</tr>
<tbody id="xxx">
............
</tbody>
</tr>
</table>