table 插入删除行

table 插入删除行

function addgxInput(talbeId) {
 var newline; 
 if(talbeId=='jdzl'){
  newline=document.all.jdzl.insertRow();
 }
 
   HTMLSrc1="<td height='25' align='center' class='tdline'><div align='center'>&nbsp;<input type='text' size='10' ></div></td>"; 
  HTMLSrc2="<td align='center' class='tdline'><div align='left'>&nbsp;<input type='text' size='35' ></div></td>"; 
  HTMLSrc3="<td align='center' class='tdline'><div align='center'>&nbsp;<input type='text' size='25' ></div></td>"; 
  HTMLSrc5="<td class='tdline'><div align='center'>"+
    "<a href='problemView.htm'><img src='<%=request.getContextPath()%>/images/icon/office/edit.gif' value='4' width='18' height='18' title='编辑'\"></a>"+
   "<img src='../images/icon/office/delete.gif' value='4' width='18' height='18' title='删除' onclick=\"delInput('"+talbeId+"',this.parentNode.parentNode.parentNode);\"></div></td>";
  newline.height="22";
 newline.bgcolor="#ffffff";
 newline.onMouseOver="this.style.backgroundColor='#ACDCEE'";
 newline.onMouseOut="this.style.backgroundColor='#FFFFFF'";
 newline.insertCell().innerHTML=HTMLSrc1;
 newline.insertCell().innerHTML=HTMLSrc2;
 newline.insertCell().innerHTML=HTMLSrc3;
 newline.insertCell().innerHTML=HTMLSrc5;
}

function delInput(tableId,x){
var temp="";
if(tableId=='jdzl'){
  temp=document.all.jdzl;
 }

temp.deleteRow(x.rowIndex);
}

你可能感兴趣的:(table 插入删除行)