js下为表格内部动态添加行的代码
未添加行之前:
添加行之后:
演示代码:
给表格内部动态添加行
.tableStyle
{
border-collapse: collapse;
width:100%;
}
td
{
font-size:12px;
height:25px;
border:1px solid #CCD5E8;
}
.btn {
font-size:12pt; color: #003399;
border: 1px #003399 solid;
color:#006699;
border-bottom: #93bee2 1px solid;
border-left: #93bee2 1px solid;
border-right: #93bee2 1px solid;
border-top: #93bee2 1px solid;
background-color: #e8f4ff;
cursor: pointer;
font-style: normal ;
width:20px;
height:22px;
font-family:Verdana;font-family:Georgia;_font-family:Tahoma;
padding:0 10px 1px;padding:3px 3px 1px;_padding:0 4px 1px;
line-height:18px;line-height:14px;_line-height:16px;
}
标的企业
股权结构 |
股东人数:人 | 前十名出资人的名称(做成动态,填几个显示几个) | 出资比例 |
评估机构 | |||
评估机构 |
//表单操作
function AddStructureRow()
{
var obj=document.getElementById("OwnershipStructure");
var tr= obj.rows["StructureRight"];
//alert(tr.rowIndex);
var count=document.getElementById("StructureLeft1").getAttribute("rowspan");
document.getElementById("StructureLeft1").setAttribute("rowSpan",parseInt(count)+1);
document.getElementById("StructureLeft2").setAttribute("rowSpan",parseInt(count)+1);
//插入行 code form www.jb51 .net
var tr =obj.insertRow(tr.rowIndex+1);
var trId="trStructure"+tr.rowIndex;
tr.setAttribute("id",trId);
var td0 = tr.insertCell(0);
td0.setAttribute("align","left");
//td0.setAttribute("colSpan","4");
td0.innerHTML = " ";
var td1 = tr.insertCell(1);
td1.setAttribute("align","left");
//td1.setAttribute("colSpan","3");
td1.innerHTML = "";
}
function DelStructureRow(rowIndex)
{
var obj=document.getElementById("OwnershipStructure");
obj.deleteRow(rowIndex);
var count=document.getElementById("StructureLeft1").getAttribute("rowspan");
document.getElementById("StructureLeft1").setAttribute("rowSpan",parseInt(count)-1); //rowSpan 不要写成rowspan,因为在IE6 与IE7下会有问题
document.getElementById("StructureLeft2").setAttribute("rowSpan",parseInt(count)-1);
}
//End---股东出资人表单操作
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]