VaR cellcount = 0; <br/> function addtr () {<br/> cellcount ++; <br/> // obtain the table to be operated <br/> var table = document. getelementbyid ("T1"); </P> <p> // dynamically Add rows <br/> var newrow = document. createelement ("TR"); <br/> // dynamically create a column <br/> var newcell0 = document. createelement ("TD"); <br/> var newcell1 = document. createelement ("TD"); <br/> // Add content dynamically <br/> newcell0.appendchild (document. createtextnode ("field" + (cellcount + 1) + ""); <br/> newrow. appendchild (newcell0); <br/> newcell1.innerhtml = "<input type = 'text' name = 'cell" + cellcount + "'>"; <br/> newrow. appendchild (newcell1); <br/> document. getelementbyid ("tbody1 "). appendchild (newrow); </P> <p>/********************** the method can be used in IE, but not in Firefox <br/> // dynamically Add rows <br/> var newrow = table. insertrow (); <br/> // Add a column to the new row <br/> var newcell0 = newrow. insertcell (); <br/> newcell0.innerhtml = "field" + (cellcount + 1); <br/> var Newcell = newrow. insertcell (); <br/> // add content to the column <br/> Newcell. appendchild = (document. createtextnode ("<input type = 'text' name = 'cell" + cellcount + "'>"); <br/> // Newcell. innerhtml = "<input type = 'text' name = 'cell" + cellcount + "'> "; <br/> ********************/<br/> document. getelementbyid ("cellcount "). value = (cellcount + 1 ); <br/>}</P> <p> <Table width = "200" border = "0" id = "T1"> <br/> <tbody id = "tbody1 "> <br/> <tr> <br/> <TD nowrap =" nowrap "> <br/> database <br/> </TD> <br/> <TD style = "text-align: left; "mce_style =" text-align: Left; "> <br/> <JSP: Include page = ".. /Includes/dblist. JSP "/> <br/> </TD> <br/> </tr> <br/> <TD> <br/> table name <br/> </TD> <br/> <input name = "tbname" type = "text"/> <br/> </TD> <br/> </tr> <br/> <TD> <br/> Primary Key <br/> </TD> <br/> <TD> <br/> <input name = "rowkey" type = "text"/> <br/> </TD> <br/> </tr> <br/> <tr> <br/> <TD nowrap = "nowrap"> <br/> Field 1 <br/> </TD> <br/> <TD> <br/> <input name = "cell0" type = "text"/> <br/> </TD> <br/> </tr> <br/> </tbody> <br/> </table> <br/> <Table> <br/> <tr> <br/> <TD nowrap = "nowrap"> <br/> <input name = "" type = "button" value = "add field" align = "Left" onclick = "addtr (); "/> <br/> </TD> <br/> <s: submit name = "addteictb" value = "Submit" align = "Left" method = "addteictb"/> <br/> </TD> <br/> <TD> <br /> <input type = "reset" value = "reset"/> <br/> </TD> <br/> </tr> <br/> </table>