var cellcount = 0; function Addtr () {cellcount++;//getting the table var table = document.getElementById ("T1") to be manipulated;//dynamic add row var NewRow = Document.creat Eelement ("tr"); Dynamically Create column var newCell0 = document.createelement ("TD"); var newCell1 = document.createelement ("TD"); Dynamically add Content Newcell0.appendchild (document.createTextNode ("field" + (Cellcount + 1) + "")); Newrow.appendchild (newCell0); newcell1.innerhtml = "<input type= ' text ' name= ' cell" + cellcount + "' >"; Newrow.appendchild (NEWCELL1); document.getElementById ("Tbody1"). AppendChild (NewRow); /******************* the method in IE can, but not in Firefox//dynamically add line var NewRow = Table.insertrow (); Add a column to the new row var newCell0 = Newrow.insertcell (); newcell0.innerhtml = "Field" + (Cellcount + 1); var Newcell = Newrow.insertcell (); Add content to Column Newcell.appendchild = (document.createTextNode ("<input type= ' text ' name= ' cell" + cellcount + "' >")); newcell.innerhtml = "<input type= ' text ' name= ' cell" + cellcount + "' >"; /document.getElementById ("CEllcount "). Value = (cellcount+1); <table width= border= "0" id= "T1" > <tbody id= "tbody1" > <tr> <td nowrap= "nowrap" > Database </t d> <td style= "text-align:left; mce_style=" Text-align:left; " > <jsp:include page= ". /includes/dblist.jsp "/> </td> </tr> <tr> <td> table name </td> <td> <input name=" Tbname "type=" text "/> </td> </tr> <tr> <td> primary key </td> <td> <input name=" Rowkey " type= "text"/> </td> </tr> <tr> <td nowrap= "nowrap" > Field 1 </td> <td> <input name = "Cell0" type= "text"/> </td> </tr> </tbody> </table> <table> <table> <tr > <TD nowrap= "nowrap" > <input name= "type=" button "value=" add Field "align=" left "onclick=" ADDTR (); "/> </td > <td> <s:submit name= "ADDTEICTB" value= "submit" align= "left" method= "ADDTEICTB"/> </td> <td> <input type= "reset" value= "reset"/> </td> </tr> </table>