dom增加表格_程序代码
dom增加表格_程序代码
<script language="javascript" type="text/javascript">
function InsertCol(obj){ //插入列
var oTd
for(j=0;j<obj.rows.length;j++){
oTd=obj.rows(j).insertCell(obj.rows(j).cells.length);
alert(obj.rows(j).cells(0));
oTd.innerHTML='<input type="text" />';
}
}
function DeleteCol(obj){ //删除列
for(j=0;j<obj.rows.length;j++)
{
if(obj.rows(j).cells.length>4)
{
obj.rows(j).deleteCell(obj.rows(j).cells.length-1);
}
}
}
</script>
<td align="right"><input name="addv_btn" id="addv_btn" type="button" class="button" onClick="InsertCol(delegateInfor3);" value="增加列" />
<input name="del_btn" id="del_btn" type="button" class="button" onClick="DeleteCol(delegateInfor3)" value="删除行" />
<TABLE id="delegateInfor3" width="100%"
border="1" align="center" cellpadding="0" cellspacing="0"
bordercolor="#CCCCCC">
<tr>
<td width="100" height="20" align="center"> </td>
<TD><input type="checkbox" class="check" onclick="ccolor()" name="checkItem"></TD>
<TD><input type="checkbox" class="check" onclick="ccolor()" name="checkItem"></TD>
<TD><input type="checkbox" class="check" onclick="ccolor()" name="checkItem"></TD>
</tr>
<tr>
<td width="100" height="20" align="center">序号 </td>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
</tr>
<tr>
<td width="100" height="20" align="center">评级类型 </td>
<TD><input type="text" name="infoValue_txt2" id="infoValue_txt2" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
</tr>
<tr>
<td width="100" height="20" align="center">评级公司 </td>
<TD><input type="text" name="infoValue_txt2" id="infoValue_txt2" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
</tr>
<tr>
<td width="100" height="20" align="center">级别 </td>
<TD><input type="text" name="infoValue_txt2" id="infoValue_txt2" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
</tr>
<tr>
<td width="100" height="20" align="center">编号 </td>
<TD><input type="text" name="infoValue_txt2" id="infoValue_txt2" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
<TD><input type="text" name="infoValue_txt1" id="infoValue_txt1" /></TD>
</tr>
</table>dom增加表格_程序代码
补充:网页制作,js教程