LyndonOHRC
Programmer
I'm trying to attach an event to my dynamic table rows so I can delete a row. The event function just has an alert so far so I can see what row the event is triggered on and the results have me confused (apparently not that hard to do).
When the event fires I get the same parameter passed to the function no matter which row I click. It is always the length of the table (number of rows). It's like every row is getting the same onclick event saved to it...
attachEvent code section:
onclick code section:
Thanks
Lyndon
---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
When the event fires I get the same parameter passed to the function no matter which row I click. It is always the length of the table (number of rows). It's like every row is getting the same onclick event saved to it...
attachEvent code section:
Code:
DupeCheck.value='';
AllValuesSort = AllValues.sort();
for (i=1; i<=HowManyScans; i++){
DupeCheck.value=DupeCheck.value+'[delim]'+AllValuesSort[(i - 1)];
var putRow=document.getElementById('tbl').insertRow();
[COLOR=red]putRow.id=(i-1)[/color];
var putCell=putRow.insertCell();
putCell.innerHTML=i+'. '+AllValuesSort[(i - 1)];
putCell.style.color='DodgerBlue';
putCell.style.Background='white';
[COLOR=red]putCell.attachEvent("onclick",function () { return DeleteMe((i-1)); })[/color];
}
document.Scan.ScannedLabel.value='';
document.Scan.ScannedLabel.focus();
}
onclick code section:
Code:
function DeleteMe(WhichRow){
getRow=document.getElementById('Row '+WhichRow);
alert(WhichRow);
}
Lyndon
---People Remember about 10% of what you say ---They never forget how you made them feel. Covey