fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> <script> function insRow(){ var x=document.getElementById('myTable').insertRow(0); var y=x.insertCell(0); var z=x.insertCell(1); y.innerHTML="新单元格1"; z.innerHTML="新单元格2"; } </script> </head> <body> <table id="myTable" border="1"> <tr> <td>行1 列1</td> <td>行1 列2</td> </tr> <tr> <td>行2 列1</td> <td>行2列2</td> </tr> <tr> <td>行3 列1</td> <td>行3 列2</td> </tr> </table> <br> <input type="button" onclick="insRow()" value="插入行"> </body> </html>
运行结果