JavaScript 参考手册
Table tbody 集合
添加行
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function insCell() { var x = document.getElementById('tr1').insertCell(0); x.innerHTML = "The famous"; } </script> </head> <body> <table border="1"> <tr id="tr1"> <td>Peter</td> <td>Griffin</td> </tr> </table> <br> <input type="button" onclick="insCell()" value="插入单元格"> </body> </html>
运行结果:
点击运行 »