ho questa funzione js che inserisce righe dinamicamente:
ora il mio problema è eliminare una riga specifica al click del pulsante.ho provato con:codice:function AddRow(cntRow) { var newcell="<input type=\"text\" name=\"riga"+"\" size=\"7\" value=\""+(tDettaglio.rows.length-1)+"\">" var newcell2="<input type=\"text\" name=\"art"+"\" size=\"20\">" var newcell3="<input type=\"text\" name=\"qnt"+"\" size=\"20\">" var newcell4="<input type=\"text\" name=\"prezzo"+"\" size=\"20\">" var newcell5="<input type=\"button\" name=\"B2"+"\" size=\"20\" value=\"Inserisci Riga\" onclick=\"AddRow()\">" var newcell6="<input type=\"button\" name=\"B3"+"\" id=\""+(cntRow+1)+"\" size=\"20\" value=\"Elimina Riga\" onclick=\"DelRow()\">" tDettaglio.insertRow() tDettaglio.rows(tDettaglio.rows.length-1).insertCell() tDettaglio.cells(tDettaglio.cells.length-1).innerHTML=newcell tDettaglio.rows(tDettaglio.rows.length-1).insertCell() tDettaglio.cells(tDettaglio.cells.length-1).innerHTML=newcell2 tDettaglio.rows(tDettaglio.rows.length-1).insertCell() tDettaglio.cells(tDettaglio.cells.length-1).innerHTML=newcell3 tDettaglio.rows(tDettaglio.rows.length-1).insertCell() tDettaglio.cells(tDettaglio.cells.length-1).innerHTML=newcell4 tDettaglio.rows(tDettaglio.rows.length-1).insertCell() tDettaglio.cells(tDettaglio.cells.length-1).innerHTML=newcell5 tDettaglio.rows(tDettaglio.rows.length-1).insertCell() tDettaglio.cells(tDettaglio.cells.length-1).innerHTML=newcell6 }
[CODE]
function DelRow() {
tDettaglio.deleteRow(document.getElementById('B3') );
}
ma elimina solo l'ultima riga della tabella e non quella selezionata

Rispondi quotando