<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]>";