用js怎么动态插入行!
<script language="JavaScript">//构造函数
function InsterCell(tableId,content,place){
this.mTableId=tableId;//table的标识
this.mInsContent=content;//inster的内容
this.mInsPlace=place;//inster的位置
this.cInsCell=InsCell;
this.cClearCell=ClearCell;
}
//插入
function InsCell(){
str=eval(this.mTableId+".cells["+this.mInsPlace+"]");//这个这样写也不行!
str.innerHTML='<table cellspacing="0" cellpadding="0" border="0" ><tr>';
this.mTableId.cells[this.mInsPlace].innerHTML=this.mInsContent;
this.mTableId.cells[this.mInsPlace].innerHTML='</tr></table>';
this.mInsPlace++;
}
//清楚
function ClearCell(){
for(i=0;i<this.mTableId.cells.length/2-1;i++){
this.mTableId.cells[2*i+1].innerHTML="";
}
}
str='<TD>交行原余额</TD>';
str+='<TD><input type="text" name="earning"></TD>';
str+='<TD><input type="text" name="payout"></TD>';
str+='<TD><input type="text" name="cashOnHand"> </TD>';
str+='<TD><input type="text" name="cashOnHandRemark"></TD>';
var ins=new InsterCell("t1","str",1);
ins.cInsCell();
</script>
代码:--------------------------------------------------------------------------------
<html>
<head>
<title>发货单</title>
</head>
<body bgcolor="#F2FDE8" text="000000" link="000000" vlink="000000" alink="000000">
<SCRIPT language="javascript">
function tbladdrow()
{
var i=lines.rows.length ;
var row = Table1.insertRow(Table1.rows.length);
var col = row.insertCell(0);
col.innerHTML = "<INPUT id=line["+i+"][Commcd] name=line["+i+"][Commcd]>";
补充:Php教程,Php入门