getting parameter value from a table using javascript
- by kawtousse
hi every one;
I want to get the parameter in my table(HTLML) table every time the user click edit button.
The table contains in each row an edit button like following:
 retour.append("<td>");
                           retour.append("<button  id=edit name=edit type=button  onClick= editarow()>");
                           retour.append("<img src=edit.gif />");
                           retour.append("</button>");
                           retour.append("</td>");
to get the value of each row where edit is clicked  using javascript I do the following:
 function  editarow(){
var table = document.getElementById("sheet");
    var buttons = table.getElementsByTagName("button");
       for(var i=0; i<buttons.length; i++) {
        if(buttons[i].name=="edit") {
            buttons[i].onclick = function() 
                {
                var buttonCell = this.parentNode;//cell
                var editThisRow = buttonCell.parentNode;//td
                var er=editThisRow.parentNode.attributes[1].value;
               alert(er);
}
}
 }
}
but i didn't get the values expected.
thanks for help