ı think , if I sent my code you can understand easily;
create table function;
var tbody = document.getElementById('t1').getElementsByTagName ('tbody')[0];
var row = document.createElement('TR');
var cell1 = document.createElement('TD');
cell1.innerHTML = myA[i];
var cell2 = document.createElement('TD');
cell2.innerHTML = myB[i];
var cell3 = document.createElement('TD');
var checkBox = document.createElement('INPUT');
checkBox.setAttribute("type", "checkbox");
cell3.appendChild(checkBox);
checkBox.checked = false;
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
tbody.appendChild(row);
i want to select one or more row to delete from table.
and i want to know which row is selected when i check the checkbox ...
may i explain now?
Your code is unmanaged.
Whether you code in any language, the rule is to first analyze your problem then go for coding.
The solution to your problem is to maintain a counter, and give name to your controls according to that counter.
If there are 4 rows already displayed(according to the records in the database), and according to some mainpulation more rows could be added. Then initialize your counter to 4. and with each manipulation increment the counter accordingly.
for eg. you are having a checkbox, a txtbox and a selectbox each row.
Then these could be named as chkABC0, chkABC1..., txtABC0, txtABC1,... , selABC0, selABC1....
here 0, 1, 2... are appended to the controls according to the counter.
so chkABC0, txtABC0, selABC0 belongs to the first row.
I think you would have got the point.
And remember, always keep in mind how you will extract an information before storing it. I noticed you havn't given any name or id to your checkboxes. How will you be able to get the reference of those checkboxes for manipulation.
Second thing is you should think of a better way of retriving information while checking for alternatives.
eg. you gave ID to your table, and then from that table extracted an array of tbody elements, and selected first element from that array.
You could have given id to tbody element itself.
So I would suggest you to reconsider your problem domain, think of how you will manage you objects then go for coding. I am saying this because there might be even better way of doing this thing. Projects that fail are 90% due to mismanagement, and 10% due to other reasons.