单击删除所在行

来源:互联网 发布:在window下安装ubuntu 编辑:程序博客网 时间:2024/04/29 17:46

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function DeleteRow(){
 event.srcElement.parentElement.parentElement.parentElement.deleteRow(event.srcElement.parentElement.parentElement.rowIndex);
}
</script>
</head>

<body>
<table width="400" border="1" cellpadding="1" cellspacing="1" bordercolor="#990000" id="mytable">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>3333333333333333333</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" id="Submit" name="Submit" value="删一行" onclick="DeleteRow()"/></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>1111111111111111</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" id="Submit" name="Submit" value="删一行" onclick="DeleteRow()"/></td>
  </tr>
</table>
</p>
</body>
</html>

原创粉丝点击