JSP Dynamic Add ranks apply to IE and Firefox

Source: Internet
Author: User

 

 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 > &LT;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"/&GT </td> </tr> </table>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.