<div class="htmlarea"> <textarea id="runcode84614"> <table id="t1" border="1"> <tr> <!--input的parentNode是TD,TD的parentNode是TR,TR的parentNode是TBODY,TBODY的parentNode才是TABLE--> <td><input type="checkbox" onclick="this.checked=false;{moveIt(this.parentNode.parentNode);}"></td> <td>1</td> </tr> <tr> <td><input type="checkbox" onclick="this.checked=false;{moveIt(this.parentNode.parentNode);}"></td> <td>2</td> </tr> </table> <hr> <table id="t2" border="1"> <tr> <td><input type="checkbox" onclick="this.checked=false;{moveIt(this.parentNode.parentNode);}"></td> <td>3</td> </tr> <tr> <td><input type="checkbox" onclick="this.checked=false;{moveIt(this.parentNode.parentNode);}"></td> <td>4</td> </tr> </table> </textarea> <br><input onclick="runEx('runcode84614')" type="button" value="运行代码"><input onclick="doCopy('runcode84614')" type="button" value="复制代码"> <input onclick="doSave(runcode84614)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 </div>]<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>