< ;script 언어="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);
newNameTD .innerHTML = "
";
var newNameTD = newTR.insertCell(2);
newNameTD.innerHTML = "<입력 이름=' BirthDay' id='BirthDay' type='text' />";
var newNameTD = newTR.insertCell(3);
newNameTD.innerHTML = "<입력 이름='age' id='age ' type='text' />";
}
function insertRow() {
var oTable = document.getElementById("table_info");
var oTr = oTable.insertRow();
var oTd = oTr.insertCell();
oTd.innerHTML = "새로운 添加了一行";
}
함수 insertRow2() {
//获取table对象
var table = document.getElementById("table_info2");
//找到要添加button적 td,这里以表格第一行第一列为例子
var oTd = table.rows[0].cells [0 ];
//添加button到td中,添加前吧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("table_info3 ");
//找到要添加버튼적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 < maxRow; i ) {
strTbody.push("");
for (var j = 0; j < maxCol; 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";
_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 & lt; maxCol; td = _doc.createElement("td");
text = _doc.createTextNode("Text");
td.insertBefore(text, null);
tr.insertBefore(td, null);
}
}
}
<시간 />