-
<html>
-
<script>
-
function dy(){
-
var row=document.createElement("tr");
-
var cell=document.createElement("td");
-
cell.appendChild(document.createTextNode("afsafaf"));
-
row.appendChild(cell);
-
document.getElementById("newbody").appendChild(row);
-
}
-
-
</script>
-
<body>
-
<br>
-
<a name="top" href="#here">go here</a>
-
<br>
-
<input type=button value="动态生成" onclick="dy()"/>
-
<br>
-
<table>
-
<tbody id="newbody"></tbody>
-
</table>
-
<br>
-
-
</body>
-
</html>
<html>
<script>
function dy(){
var row=document.createElement("tr");
var cell=document.createElement("td");
cell.appendChild(document.createTextNode("afsafaf"));
row.appendChild(cell);
document.getElementById("newbody").appendChild(row);
}
</script>
<body>
<br>
<a name="top" href="#here">go here</a>
<br>
<input type=button value="动态生成" onclick="dy()"/>
<br>
<table>
<tbody id="newbody"></tbody>
</table>
<br>
</body>
</html>
-
var obj = document.createElement(
"table"
);
-
var tbody = document.createElement("tbody");
-
var tr = document.createElement("tr");
-
var td = document.createElement("td");
-
td.innerText = "AAA"
-
tr.appendChild(td);
-
tbody.appendChild(tr);
-
obj.appendChild(tbody);
-
document.all.Form1.appendChild(obj);
-
var obj2 = new Array();
-
for (var i=0;i<5;i++)
-
{
-
obj2[i] = obj.cloneNode(true);
-
obj2[i].setAttribute("border","1");
-
document.all.Form1.appendChild(obj2[i]);
-
}
-
var obj = document.createElement("table");
var tbody = document.createElement("tbody");
var tr = document.createElement("tr");
var td = document.createElement("td");
td.innerText = "AAA"
tr.appendChild(td);
tbody.appendChild(tr);
obj.appendChild(tbody);
document.all.Form1.appendChild(obj);
var obj2 = new Array();
for (var i=0;i<5;i++)
{
obj2[i] = obj.cloneNode(true);
obj2[i].setAttribute("border","1");
document.all.Form1.appendChild(obj2[i]);
}
减少:
deleteRow
deleteCell
posted on 2008-08-18 10:04
无声 阅读(1366)
评论(0) 编辑 收藏 所属分类:
职场生活