Create Rows based on other rows dynamically

admin

Administrator
Staff member
I have a table made dynamically on server. I want to create a new row like first row and append it to the table using Java Script .

I tried the following code but it doesn't work


<table id="tblDataEntry1" bordercolor="LightGrey" border="0" style="border-color:LightGrey;">
<tr>
<td><select name="ddlUserId1" id="ddlUserId1" style="width:70pt;">
<option value=http://www.webdeveloper.com/forum/archive/index.php/""></option>
<option selected="selected" value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="6">6</option>

</select><select name="ddlScore1" id="ddlScore1" style="width:50px;">
<option value=""></option>
<option value="20">20</option>
<option value="19">19</option>


</select><input name="txtComment1" type="text" id="txtComment1" style="width:600px;" /></td>
</tr>
</table>



<INPUT id="Add1" type="button" value="Add Empty Row" onclick="AddRow"></P>

<script>
function AddRow()
{
var MyTable=document.getElementById("tblDataEntry1");
var MyRow=MyTable.getElementsByTagName("tr")[0];
MyTable.appendChild(MyRow);
}
</script>
 
Back
Top