62,046
社区成员
发帖
与我相关
我的任务
分享
function CreateTable(ds)
{
var maxRow =8;
var maxCol = 3;
var aaa="test";
var strTbody ="<table <tbody>";
strTbody+="<tr>";
for(var j = 0; j < maxCol; j++)
{
strTbody+="<td><input id=\"txt"+i+"\" type =\"text\" value ="+aaa+" /></td>";
}
strTbody+="</tr>";
strTbody+="</tbody></table>";
var obj = document.getElementById("tableDiv");
obj.innerHTML = strTbody;
}
function addRow()
{
//添加一行
var newTr = tableone.insertRow();
//添加3列
var newTd0 = newTr.insertCell();
var newTd1 = newTr.insertCell();
var newTd2 = newTr.insertCell();
//设置列内容和属性
newTd0.className = "LtableCopy";
newTd0.height = "25";
newTd0.align = "center";
newTd0.innerHTML = "<input type='text' name='pickname' />";
newTd1.className = "LtableCopy";
newTd1.height = "25";
newTd1.align = "center";
newTd1.innerHTML = "<input type='text' name='pickrelationship'/>";
newTd2.className = "LtableCopy";
newTd2.height = "25";
newTd2.align = "center";
newTd2.innerHTML = "<input type='text' name='picknumber' />";
}
<table id="tableone" border="1">
</table>
<input type="button" value="add" onclick="addRow()" />