<html>
<head><title>a</title>
<script type='text/javascript'>
function add(){
var list=document.getElementById("list");
var row=document.createElement("tr");
var cell=document.createElement("td");
var text=document.createTextNode("新增");
cell.setAttribute("colspan","2");
//cell.setAttribute("width","100%");
cell.appendChild(text);
row.appendChild(cell);
list.appendChild(row);
}
</script>
</head>
<body>
<table height="400" width="80%" align="center" bgcolor="#00CC99">
<tbody id="list">
<tr>
<td width="50%" align="left">a</td>
<td width="50%" align="left">b</td>
</tr>
<tbody>
</table>
<input type='button' value='新增' onclick="add()">
在javascript中动态增加一行时想要合并列。。
</body>
</html>
<head><title>a</title>
<script type='text/javascript'>
function add(){
var list=document.getElementById("list");
var row=document.createElement("tr");
var cell=document.createElement("td");
var text=document.createTextNode("新增");
cell.setAttribute("colspan","2");
//cell.setAttribute("width","100%");
cell.appendChild(text);
row.appendChild(cell);
list.appendChild(row);
}
</script>
</head>
<body>
<table height="400" width="80%" align="center" bgcolor="#00CC99">
<tbody id="list">
<tr>
<td width="50%" align="left">a</td>
<td width="50%" align="left">b</td>
</tr>
<tbody>
</table>
<input type='button' value='新增' onclick="add()">
在javascript中动态增加一行时想要合并列。。
</body>
</html>
----------------------------
<script type='text/javascript'>function add(){
var table = document.getElementById("table1"); var row = table.insertRow();
var cell = row.insertCell();
cell.colSpan=2;
cell.innerText="新增";
}
</script>