Amy wrote:
Is it possible to do so?
Simple answer, yet.
Really horrible script demonstrating a way to add 2 rows:
<html>
<body>
<script type="text/javascript">
function addRow(id){
var table = document.getEle mentById(id);
var rowToClone = table.rows[0];
var oRow = rowToClone.clon eNode(true);
var input = oRow.getElement sByTagName('inp ut')[0];
input.name = 'input' + table.rows.leng th;
input.value = '';
rowToClone.pare ntNode.appendCh ild(oRow);
}
function add2Row(id){
var table = document.getEle mentById(id);
var rowToClone = table.rows[0];
var oRow = rowToClone.clon eNode(true);
var input = oRow.getElement sByTagName('inp ut')[0];
for(var i=0;i<2;i++) {
input.name = 'input' + table.rows.leng th;
input.value = '';
rowToClone.pare ntNode.appendCh ild(oRow);
}
}
</script>
<button onclick="addRow ('tableA')">Add row</button><br>
<button onclick="add2Ro w('tableA')">Ad d 2 rows</button>
<form action="">
<table id="tableA">
<tr>
<td><input name="input0" onclick="this.v alue=this.name" ></td>
</tr>
</table>
</form>
</body>
</html>