<html>
<head>
<script type="text/javascript">
function deleteRow(i)
{
document.getElementById('myTable').deleteRow(i)
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>Row 1</td>
<td><input type="button" value="Delete" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
</tr>
<tr>
<td>Row 2</td>
<td><input type="button" value="Delete" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
</tr>
<tr>
<td>Row 3</td>
<td><input type="button" value="Delete" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
</tr>
</table>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script language="javascript" >
function del(id)
{
var table = document.getElementById("tbl");
var tr = document.getElementById("tr"+id);
table.deleteRow(tr.rowIndex);
}
</script>
</head>
<body>
<table width="300" border="1" id="tbl">
<tr>
<td>id</td>
<td>name</td>
<td>family</td>
<td>operation</td>
</tr>
<?php
include("connect.php");
$sel2=mysql_query('SELECT * FROM test ')or die(mysql_error());
while($num=mysql_fetch_assoc($sel2))
{ ?>
<?php $id = $num['nid']; ?>
<tr id="tr<?php echo($id); ?>);">
<td><?php echo $num['nid']; ?></td>
<td><?php echo $num['name']; ?></td>
<td><?php echo $num['family']; ?></td>
<td><input type="button" name="btn1" onClick="del(<?php echo($id); ?>);" value="delete" /></td>
</tr>
<?php
}
mysql_close($conect1);
?>
</table>
</body>
</html>
table.deleteRow(tr.parentNode.parentNode.rowIndex);
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script language="javascript" >
function del(id)
{
var table = document.getElementById("tbl");
var tr = document.getElementById("tr"+id);
table.deleteRow(tr.rowIndex);
}
</script>
</head>
<body>
<table width="300" border="1" id="tbl">
<tr>
<td>id</td>
<td>name</td>
<td>family</td>
<td>operation</td>
</tr>
<?php
include("connect.php");
$sel2=mysql_query('SELECT * FROM test ')or die(mysql_error());
while($num=mysql_fetch_assoc($sel2))
{ ?>
<?php $id = $num['nid']; ?>
<tr id="tr<?php echo($id); ?>);">
<td><?php echo $num['nid']; ?></td>
<td><?php echo $num['name']; ?></td>
<td><?php echo $num['family']; ?></td>
<td><input type="button" name="btn1" onClick="del('<?php echo($id); ?>');" value="delete" /></td>
</tr>
<?php
}
mysql_close($conect1);
?>
</table>
</body>
</html>