标签:put div highlight delete document javascrip val for cell
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>表格的增删改操作</title> <script type="text/javascript"> function createTable() { var body = document.getElementById("test"); var table = document.createElement("table"); table.id = "table1"; table.border=1; //行 ,单元格 for(var i = 0;i<5;i++){ var row = table.insertRow(i); for(var j=0;j<4;j++){ var cell = row.insertCell(j); cell.innerHTML="值"+i+j; } } body.appendChild(table); } function deleteLastRow(){ } function deleteLastCell(){ } </script> </head> <body id="test"> <input type="button" value="创建一个5行4列的表格" onclick="createTable()"/> <input type="button" value="删除最后一行" onclick="deleteLastRow()"/> <input type="button" value="删除最后一个单元格" onclick="deleteLastCell()"/> </body> </html>
标签:put div highlight delete document javascrip val for cell
原文地址:http://www.cnblogs.com/john568300/p/6411218.html