Eliminar Fila de una Tabla
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
function eliminarFila(t){
var td = t.parentNode;
var tr = td.parentNode;
var table = tr.parentNode;
table.removeChild(tr);
}
</script>
</head>
<body>
<table id="tabla" border="1">
<thead>
<tr>
<th>Nro.Documento</th>
<th>Nombres</th>
<th>Accion</th>
</tr>
</thead>
<tbody>
<tr>
<td>12345678</td>
<td>Jorge</td>
<td><input type="button" value="Eliminar" onclick="eliminarFila(this);"></td>
</tr>
<tr>
<td>12345679</td>
<td>Christian</td>
<td><input type="button" value="Eliminar" onclick="eliminarFila(this);"></td>
</tr>
<tr>
<td>12345670</td>
<td>Mario</td>
<td><input type="button" value="Eliminar" onclick="eliminarFila(this);"></td>
</tr>
</tbody>
</table>
</body>
</html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
function eliminarFila(t){
var td = t.parentNode;
var tr = td.parentNode;
var table = tr.parentNode;
table.removeChild(tr);
}
</script>
</head>
<body>
<table id="tabla" border="1">
<thead>
<tr>
<th>Nro.Documento</th>
<th>Nombres</th>
<th>Accion</th>
</tr>
</thead>
<tbody>
<tr>
<td>12345678</td>
<td>Jorge</td>
<td><input type="button" value="Eliminar" onclick="eliminarFila(this);"></td>
</tr>
<tr>
<td>12345679</td>
<td>Christian</td>
<td><input type="button" value="Eliminar" onclick="eliminarFila(this);"></td>
</tr>
<tr>
<td>12345670</td>
<td>Mario</td>
<td><input type="button" value="Eliminar" onclick="eliminarFila(this);"></td>
</tr>
</tbody>
</table>
</body>
</html>
Comentarios
Publicar un comentario