【发布时间】:2014-04-13 10:47:49
【问题描述】:
这是我的 html 代码:http://jsfiddle.net/Udxyb/417/
在上面的代码中,我在第一个 tr 中有四列(例如:section1、section2、section3、section4)。但是在我的表的下一个 tr 中,我想要 8 列与第一个 tr 具有相同的宽度(例如:item 111,第 112 项,第 113 项,第 114 项,第 115 项,第 116 项,第 117 项,第 118 项)。
<table id="main_table">
<thead>
<tr class="firstline">
<th>Column1</th>
<th>Column2</th>
<th>Column3</th>
<th>Column4</th>
</tr>
</thead>
<tbody>
<tr style="width:1002px; background-color:green; color:white">
<td colspan="" class="flip"> Section 1 </td>
<td colspan="" class="flip"> Section 2 </td>
<td colspan="" class="flip"> Section 3 </td>
<td colspan="" class="flip"> Section 4 </td>
</tr>
</tbody>
<tbody class="section">
<tr>
<td>item 111</td>
<td>item 112</td>
<td>item 113</td>
<td>item 114</td>
<td>item 115</td>
<td>item 116</td>
<td>item 117</td>
<td>item 118</td>
</tr>
<tr>
<td>item 121</td>
<td>item 122</td>
<td>item 123</td>
<td>item 124</td>
</tr>
<tr>
<td>item 131</td>
<td>item 132</td>
<td>item 133</td>
<td>item 134</td>
</tr>
</tbody>
<tbody>
<tr style="background-color:green; color:white">
<td colspan="" class="flip"> Section 1 </td>
<td colspan="" class="flip"> Section 2 </td>
<td colspan="" class="flip"> Section 3 </td> <td colspan="" class="flip"> Section 4 </td>
</tr>
</tbody>
<tbody class="section">
<tr>
<td>item 211</td>
<td>item 212</td>
<td>item 213</td>
<td>item 214</td>
</tr>
<tr>
<td>item 221</td>
<td>item 222</td>
<td>item 223</td>
<td>item 224</td>
</tr>
<tr>
<td>item 231</td>
<td>item 232</td>
<td>item 233</td>
<td>item 234</td>
</tr>
</tbody>
<tbody>
<tr style="background-color:green; color:white">
<td colspan="" class="flip"> Section 1 </td>
<td colspan="" class="flip"> Section 2 </td>
<td colspan="" class="flip"> Section 3 </td>
<td colspan="" class="flip"> Section 4 </td>
</tr>
</tbody>
<tbody class="section">
<tr>
<td>item 311</td>
<td>item 312</td>
<td>item 313</td>
<td>item 314</td>
</tr>
<tr>
<td>item 321</td>
<td>item 322</td>
<td>item 323</td>
<td>item 324</td>
</tr>
<tr>
<td>item 331</td>
<td>item 332</td>
<td>item 333</td>
<td>item 334</td>
</tr>
</tbody>
</table>
这是我的 jquery 代码:
jQuery(function($) {
$("#polls").on("click", ".flip", function() {
$(this)
.closest('tbody')
.next('.section')
.toggle('fast');
});
});
【问题讨论】:
标签: javascript jquery html css