hi guys...
1)i have a table called "main_table", in this table , i have table_body called "table_body"
2)in this table body i have table row called "table_row_clone" which i want to add and remove when a [+] and [-] clicked.
3)adding and removing of row is working....but my problem is,,,
i'm not able to increment the value of "ADDRESS SEQ NUM" in the "CLONED ROW"...I tried but not working..
please guide me guys....
<html>
<head>
<script>
function clonetable()
{
var row = document.getElementById("table_row_clone"); // find row to copy
var table = document.getElementById("table_body"); // find table to append to
var clone = row.cloneNode(true); // copy children too
clone.id = "abc"; // change id or other attributes/contents
table.appendChild(clone); // add new row to end of table
}
function deltable()
{
var x=document.getElementById("main_table"); //get the table
var rowCount = x.rows.length;
if(rowCount>1)
{
x.deleteRow(rowCount-1);
}//delete the last row
}
</script>
</head>
<body>
<table id="main_table" align="center" style="width:75%" >
<tbody id="table_body">
<tr id="table_row_clone">
<td>
<table align="center" style="width:100%" >
<tr >
<td align="center">
<div style="border:3px solid silver;border-radius:5px;background-color:grey">
<table width="100%" >
<tr>
<th align="center" >
Address Details
</th>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div style="border:3px solid silver;border-radius:5px;background-color:#1E90FF">
<table align="center" style="width:99%">
<tr style="background-color:#1E90FF">
<td style="width:35%">
<table width="100%">
<tr id="slrow">
<td style="width:43%">
Address Seq Num
</td>
<td>
<input id="asn"style="width:60px" name="address_seq_num" type="text" value="1" readonly>
</td>
</tr>
</table>
</td>
<td width="49%" align="right" >
<input style="width:80%" type="text" value="Reg.office/Primary Office">
</td>
<td align="right">
<input style="width:30px" type="button" value="+" onclick="clonetable()">
<input style="width:30px" type="button" value="-" onclick="deltable()">
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div style="border:3px solid silver;border-radius:5px;background-color:#1E90FF">
<table align="center" style="width:99%" >
<tr >
<td align="left" style="width:50%">
<table width="100%">
<tr>
<td style="width:30%">
Effective Date
</td>
<td style="width:70%" >
<input style="background-color:white;width:44.5%" name="effdt" type="text" class="tcal">
</td>
</tr>
</table>
<td style="width:50%">
<table width="100%" >
<tr>
<td align="right">
Effective Status
</td>
<td style="width:45%">
<select name="eff_status" name="eff_status" style="float:right;width:145px" id="estatus">
<option value="Active" selected>Active</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>