how to a assign unique id to all clone textboxes..i need it badly please help..
<script type="text/javascript">
function Clone() {
var srcTable = document.getElementById("srcTable");
var clonedTable = srcTable.cloneNode(true);
clonedTable.id = ""; // clear the id property of the cloned table
//var container = document.getElementById("container");
var container = document.getElementById("tr");
container.appendChild(clonedTable);
}
function CloneDiv() {
var srcTable = document.getElementById("SubDiv");
clonedTable.id = "";
var container = document.getElementById("MasterDiv");
function getID(txt) {
var id = txt.id;
</script>
<div id="MasterDiv">
<div id="metric_results">
<input type="button" id="create" value="Click here" onclick="Javascript:addTable()">
</div>
<div id="SubDiv" runat="server">
<div>
<asp:Image runat="server" id="imgExpand" ImageUrl="~/expand-blue.png"/>
<asp:Image runat="server" id="imgCollapsed" ImageUrl="~/collapse-blue.png" />
<asp:Label ID="Label1" runat="server" Text="PLANT"></asp:Label>
<div id="divHide">
<div id="container" style="overflow: scroll; overflow-y:hidden; width:1000px">
<table cellpadding=0 cellspacing=0 >
<tr id="tr">
<td valign="top">
<table cellpadding=0 cellspacing=0 width="400px">
<tr>
<td height="21px"></td>
</tr>
<td>WSP (VAT-Inc; Including of FTH Recharge)</td>
<td>GROSS REVENUE (VAT EX)</td>
<td>LESS: DISCOUNTS</td>
<td>NET REVENUE</td>
<td>@NTG</td>
<td>DIRECT COGS:</td>
<td>Std Concentrate Cost</td>
<td>Actual</td>
<td>Sugar</td>
<td>Other Raw Materials</td>
<td>Packaging Raw Materials</td>
<td>Overhead</td>
<td>Purchased FG</td>
<td>OTHER VARIABLE COST:</td>
<td>Delivery/Freight</td>
<td>EDS/Distributor Fees</td>
<td>Sales Commission</td>
<td>TOTAL VARIABLE COSTS</td>
<td>MARGINAL CONTRIBUTION</td>
<td>%MC</td>
<td>LESS: BUNDLING COST PER CASE</td>
<td>Manpower</td>
<td>Material (please specify)</td>
<td>1.</td>
<td>2.</td>
<td>3.</td>
<td>4.</td>
<td>5.</td>
<td>TOTAL BUNDLING COSTS PER CASE</td>
<td>NET MARGINAL CONTRIBUTION</td>
</table>
</td>
<td valign="top" id="srcTable">
<table cellpadding=0 cellspacing=0>
<td colspan="5" align="center">P-Reg Sample</td>
<td colspan="2" align="center">ACTUAL</td>
<td>AOP</td>
<td colspan="2" align="center">(B/W)</td>
<td>FROM(Current)</td>
<td>TO(Proposed)</td>
<td></td>
<td>vs.Current</td>
<td>vs.AOP</td>
<td><asp:TextBox ID="sample" runat="server" Text="0.00" onblur="getID(this)"></asp:TextBox></td>
<td><asp:TextBox runat="server" Text="0.00"></asp:TextBox></td>
protected void Page_Load(object sender, EventArgs e)
{
for (int x = 0; x < 2; x++)
for (int i = 0; i < 1; i++)
ScriptManager.RegisterStartupScript(this, GetType(), "CloneTable" + i, "Clone();", true);
ScriptManager.RegisterStartupScript(this, GetType(), "CloneDiv" + x, "CloneDiv();", true);