【发布时间】:2011-04-25 21:49:53
【问题描述】:
我有一张典型的桌子,
7 列,(每次分页到 100 行)。
我想要做的是有一个<select multiple="multiple"> 并让它根据名称列出所有列是各自的<th></th>,然后我想挂钩到 select onchange 事件,当发生更改时隐藏所有列未被选中,对于隐藏的每一列,将 <tfoot> 的 colspan 减少 1。
表结构为:
<table>
<thead>
<tr>
<th>first</th>
<th>second</th>
<th>third</th>
<th>fourth</th>
<th>fifth</th>
<th>sixth</th>
<th>seventh</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7"></td>
</tr>
</tfoot>
</table>
我怀疑结尾选择会是这样的:
<select multiple="multiple">
<option value="1" selected="selected">first</option>
<option value="2" selected="selected">second</option>
<option value="3" selected="selected">third</option>
<option value="4" selected="selected">fourth</option>
<option value="5" selected="selected">fifth</option>
<option value="6" selected="selected">sixth</option>
<option value="7" selected="selected">seventh</option>
</select>
【问题讨论】:
-
请参考 stackoverflow.com/questions/12455699/… 以获得 colspan 的答案
标签: jquery html-table