At the moment I have some code that allows me to add a new row to my table, along with a new text field.
Code: Select all
var currentTxtBx = 0;
function addRow(tableID) {
if (currentTxtBx<10){
if (currentTxtBx<10){
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
var element1 = document.createElement("input");
element1.type = "text";
element1.name = 'check'+(currentTxtBx+1);
currentTxtBx++;
cell1.appendChild(element1);
}
}
else
{
alert('cannot add more than 10 boxes');
}
}
</SCRIPT>
Code: Select all
<form name="test" method="post" action="insert.php">
<INPUT type="button" value="Add Row" onclick="addRow('dataTable')" />
<INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')" />
<input type="submit" name="submit" value="Test Submit">
<TABLE id="dataTable" width="350px" border="0">
</TABLE>
</form>
Please could someone help me out with this.
Thanks