日期:2014-05-16 浏览次数:20353 次
<table id="tab1" width="200" border="1" >
<tr>
<td >a</td>
<td>x1</td>
<td>1</td>
</tr>
<tr>
<td>a</td>
<td>x1</td>
<td>2</td>
</tr>
<tr>
<td>a</td>
<td>x2</td>
<td>1</td>
</tr>
<tr>
<td>b</td>
<td>x3</td>
<td>1</td>
</tr>
<tr>
<td>c</td>
<td>x4</td>
<td>2</td>
</tr>
<tr>
<td>d</td>
<td>x5</td>
<td>2</td>
</tr>
</table>
<script>
//tabId:表ID
function mergeCell(tabId){
var tb=document.getElementById(tabId),rs=tb.rows,ac,acv;
if(!rs.length) return;
for(var i=0,L=rs[0].cells.length;i<L;i++){