Code for moving data between two tables.
<Script language = javascript> function moveIt (obj) {var tableId; if (obj. parentNode. parentNode. id = "t1") {tableId = document. getElementById ("t2");} else {tableId = document. getElementById ("t1");} var newRow = tableId. insertRow (0); newRow. insertCell (0 ). innerHTML = obj. cells (0 ). innerHTML; newRow. insertCell (1 ). innerHTML = obj. cells (1 ). innerHTML; obj. removeNode (true);} script <table id = t1 border = 1> <Tr> <! -- The parentNode of input is TD, The parentNode of TD is TR, The parentNode of TR is TBODY, And the parentNode of TBODY is TABLE --> <td> <input type = checkbox onclick = "this. checked = false; {moveIt (this. parentNode. parentNode);} "> </td> <td> 1 </td> </tr> <td> <input type = checkbox onclick =" this. checked = false; {moveIt (this. parentNode. parentNode );} "> </td> <td> 2 </td> </tr> </table> <table id = t2 border = 1> <tr> <td> <input type = checkbox onclick = "this. checked = false; {moveIt (this. parentNode. parentNode);} "> </td> <td> 3 </td> </tr> <td> <input type = checkbox onclick =" this. checked = false; {moveIt (this. parentNode. parentNode);} "> </td> <td> 4 </td> </tr> </table>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]