insert child
I have a table with header row and body rows. Body rows are named as "tr1" When i click a button, it asks the user to delete particular row. I did like this
<input type="button" value="Delete" onclick="delRow('tr1')">
<script language="javascript">
function delRow(_id){
//window.prompt to get the number from user
var _elm=document.getElementById(_id);
var _par=_elm.parentNode;
var _remid=_par.removeChild(_elm);
}
</script>
But it always deletes the first row(tr1(0)) only.
How can i delete specific(tr1(2)).
And, how can i insert new child. I tried,
_par.appendChild(_elm)
But it overwrites existing. Coz already tr1 is there.
How can i insert new child with the same name as 'tr1'
Thanx in advance
|