< ;script language="javascript" type="text/javascript">
function addRow() {
var newTR = document.getElementById("testTable").insertRow(document.getElementById("testTable"). rows.length);
var newNameTD = newTR.insertCell(0);
newNameTD.innerHTML = "aa";
var newNameTD = newTR.insertCell(1);
newName TD.innerHTML = "
";
var newNameTD = newTR.insertCell(2);
newNameTD.innerHTML = "
";
var newNameTD = newTR.insertCell(3);
newNameTD.innerHTML = "
";
}
function insertRow() {
var oTable = document.getElementById("table_info");
var oTr = oTable.insertRow( );
var oTd = oTr.insertCell();
oTd.innerHTML = "新追加了一行";
}
function insertRow2() {
//获取テーブル对象
var table = document.getElementById("table_info2");
//要追加ボタンのtd、这里以表格第一行第一列は例子
var oTd = table.rows[0].cells[0] ];
// 追加buttontotd中、追加前吧td内容清空并赋予buttonの代码
oTd.innerHTML = "
}
function insertRow22() {
var oTable = document.getElementById("table_info2");
var oTr = oTable.insertRow();
var oTd = oTr。 insertCell();
oTd.innerHTML = "新追加了一行";
}
function insertRow3() {
//获取table对象
var table = document .getElementById("テーブル情報3 ");
//要追加ボタンのtd、这里以表格第一行第一列は例子
var oTd2 = table.rows[0].insertCell();
oTd2.innerHTML = "&nbps;";
}
function tableDiv() {
var maxRow = 4;
var maxCol = 8;
var strTbody = ["
"];
for (var i = 0; i strTbody.push("");
for (var j = 0; j strTbody.push("test | ");
}
strTbody.push("
");
}
strTbody.push ("
");
var obj = document.getElementById("tableDiv");
obj.innerHTML = strTbody.join("");
}
function init() {
var _table, _tbody, tr, td, text, maxRow, maxCol;
var docBody = document.body;
var _doc = document;
maxRow = 5;
maxCol = 8;
_table = _doc.createElement("table");
_table.border = "1";
_table.style.tableLayout = "fixed";
_tbody = _doc.createElement("tbody");
_table.insertBefore(_tbody, null);
docBody.insertBefore(_table, null);
for (var i = 0;私は<最大行; i ) {
tr = _doc.createElement("tr");
_tbody.insertBefore(tr, null);
for (var j = 0; j td = _doc.createElement("td");
text = _doc.createTextNode("Text");
td.insertBefore(text, null);
tr.insertBefore(td, null);
}
}
}