hi,
i have a button that creates a new row on each button click.The row has textboxes ,dropdown lists etc whose value is passed onto another ajax function.My problem is that i am not able to set a unique id like test#i# to all the fields in each row created.This is the function used to create the new rows.
[HTML]<SCRIPT LANGUAGE="JavaScript">
function addRow(id)
{
var tbody = document.getElementById(id).getElementsByTagName(" TBODY")[0];
var row = document.createElement("TR");
var td1 = document.createElement("TD");
td1.innerHTML='<label><input type="checkbox" name="Datum#i#" value="1"></label>';
var oldHTML = document.getElementById('test').innerHTML
var td2 = document.createElement("TD");
td2.innerHTML=oldHTML;
var td3 = document.createElement("TD");
var oldHTML1=document.getElementById('test1').innerHTM L
td3.innerHTML=oldHTML1;
var td4 = document.createElement("TD");
var oldHTML2=document.getElementById('test2').innerHTM L
td4.innerHTML=oldHTML2;
var td5 = document.createElement("TD");
var oldHTML3=document.getElementById('test3').innerHTM L
td5.innerHTML=oldHTML3;
var td6 = document.createElement("TD");
var oldHTML4=document.getElementById('test4').innerHTM L
td6.innerHTML=oldHTML4;
var td7 = document.createElement("TD");
var oldHTML5=document.getElementById('test5').innerHTM L
td7.innerHTML=oldHTML5;
var td8 = document.createElement("TD");
var oldHTML6=document.getElementById('test6').innerHTM L
td8.innerHTML=oldHTML6;
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
row.appendChild(td4);
row.appendChild(td5);
row.appendChild(td6);
row.appendChild(td7);
row.appendChild(td8);
tbody.appendChild(row);
}
</script>[/HTML]
please let me know how i can set the ids of all the fields created when a new row is created.'id' passed to the function is the table id.