Hi All,
I have an existing HTML table, part of a form where the user enters GPS points. The user also has the option to upload GPS data points. I'd like to have a button the user can press where some Javascript will add one or more new rows to the table, but the new row(s) must continue incrementing the name and id values used in the table. E.g. if the last row had a name="x5", the newly inserted row should have name="x6" etc.
Would be grateful for any tips on how to do this.
TY, Fred
<table class="StdTable" id="gpsTable">
<thead>
<th><div class="StdTableHeadingSmall">Sequence</div></th>
<th><div class="StdTableHeadingSmall">X</div></th>
<th><div class="StdTableHeadingSmall">Y</div></th>
</thead>
<tbody>
<tr>
<td class="zSmall" style="text-align: right;"><div class="StdTableData">1</div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="x1" id="x1" size="8" maxlength="16" value="38.0"/></div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="y1" id="y1" size="8" maxlength="16" value="-122.0"/></div></td>
</tr>
<tr>
<td class="zSmall" style="text-align: right;"><div class="StdTableData">2</div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="x2" id="x2" size="8" maxlength="16" value="38.2"/></div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="y2" id="y2" size="8" maxlength="16" value="-122.2"/></div></td>
</tr>
<tr>
<td class="zSmall" style="text-align: right;"><div class="StdTableData">3</div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="x3" id="x3" size="8" maxlength="16" value="38.3"/></div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="y3" id="y3" size="8" maxlength="16" value="-122.4"/></div></td>
</tr>
<tr>
<td class="zSmall" style="text-align: right;"><div class="StdTableData">4</div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="x4" id="x4" size="8" maxlength="16" value="38.1"/></div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="y4" id="y4" size="8" maxlength="16" value="-122.1"/></div></td>
</tr>
<tr>
<td class="zSmall" style="text-align: right;"><div class="StdTableData">5</div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="x5" id="x5" size="8" maxlength="16" value="38.9"/></div></td>
<td class="zSmall"><div class="StdTableData"><input type="text" name="y5" id="y5" size="8" maxlength="16" value="-123.0"/></div></td>
</tr>
</tbody>
</table>