1. Get the Table object
2. Loop, column loop, and then iterate through the input values in each lattice
3. Connect with a connector
4. Place inside the hidden field of the form.
5. Pass to the background.
JS Code: NOTE: 1.input must be followed by [0] Otherwise the value 2 cannot be removed. In the double quotation mark of JS cannot be changed to "" and {} in quotation marks will also be recognized error. Pass the string back to background processing
functiongetinfofromtable () {varTableinfo = ""; varTableobj = document.getElementById ("booktable"); //alert (tableObj.rows.length); //getting data from the second row for(vari = 2; i < tableObj.rows.length; i++) {//traverse all row of table for(varj = 0; J < Tableobj.rows[i].cells.length; J + +) {//iterate through each column in rowTableinfo + = tableobj.rows[i].cells[j].getelementsbytagname ("input") [0].value;//get the contents of a cell in a tableTableinfo + = ","; }} alert (Tableinfo); } functionAddtablerow () {varTable = document.getElementById ("booktable");//Get the Custom Table objectNewRow = Table.insertrow ();//Adding RowsNewcell1= Newrow.insertcell ();//Adding ColumnsNewcell2=Newrow.insertcell (); NewCell3=Newrow.insertcell (); NEWCELL4=Newrow.insertcell (); Newcell2.colspan=2; Newcell1.innerhtml= "<input required= ' required ' type= ' text '/>";//Add DataNewcell2.innerhtml= "<input required= ' required ' type= ' text '/> '; Newcell3.innerhtml= "<input required= ' required ' onkeyup= ' Jhshnumbertext (this) '/> '; Newcell4.innerhtml= "<input required= ' required ' onkeyup= ' Jhshnumbertext (this) '/> '; } </script>
HTML JS Gets the value of all input in the table passed to the front end