源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</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>
运行结果