All pastes #906844 Raw Edit

Stuff

public text v1 · immutable
·published 2008-02-17 01:00 UTC
rendered paste body
<script>
function addRow(aTable) {
 aRow = aTable.insertRow(aTable.rows.length);
 numCells=5
 var col_dir = ['<input type="button" value="Del" onClick="delete_this_row(this)" class="btn-submit3">',
 '<input type="text" name="dirFax">',
 '<input type="text" name="dirEmail">',
 '<input type="text" name="dirPhone">',
 '<input type="text" name="dirName">']

 aCell = aRow.insertCell(0);
 aCell.innerHTML='<input type="button" id="delRow" onClick="delRow(this)" value="delete">'
 for (i=1;i<numCells;i++){
  aCell = aRow.insertCell(i);
  aCell.innerHTML= col_dir[i]
 }

}

function delRow(row) {
row.parentNode.parentNode.parentNode.deleteRow(row.parentNode.parentNode.rowIndex);
}
</script>

<form name="addeditlisting" method="post">
<table id="myTable" name="myTable" border="1" width="200">
<tbody id="myTableTBody" name="myTableTBody">
  <tr>
    <td>&nbsp;</td>
    <td>Name</td>
    <td>Phone</td>
    <td>Email</td>
    <td>Fax</td>
  </tr>
  <tr>
    <td width="67"><input type="button" id="delRow" onClick="delRow(this)" value="delete"></td>
    <td><input type="text" name="dirName"></td>
    <td><input type="text" name="dirPhone"></td>
    <td><input type="text" name="dirEmail"></td>
    <td><input type="text" name="dirFax"></td>
  </tr>
</tbody>
</table>
<p><input type="button" id="addRow" onClick="addRow(document.getElementById('myTable'))" value=" add row"> </p>
<p><input type="submit" name="submit" value="Submit"> </p>
</form>