动态新增文本框
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<script>
var count = 0;
function addByScript() {
var table = document.getElementById("tbl1");
var newRow = table.insertRow(table.rows.length);
newRow.id = "row" + count;
var contentCell = newRow.insertCell(-1);
contentCell.innerHTML = '<input type="text" />';
contentCell = newRow.insertCell(-1);
var delBtn = document.createElement("input");
delBtn.type = "button";
delBtn.className = "button";
delBtn.id = "btnDel"+count;
delBtn.value = "删除";
delBtn.onclick = new Function("del(this)");
contentCell.appendChild(delBtn);
count++;
}
function del(obj) {
var row = obj.parentNode.parentNode;
row.parentNode.removeChild(row);
}
</script>
</head>
<body>
<fieldset>
<legend>
insertRow新增
</legend>
<input type="button" class="button" value="新增" onclick="addByScript()"/>
<table id="tbl1">
</table>
</fieldset>
</body>
</html>