<!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>
</head><body>
<script language="javascript">
function ss(obj)
{
alert(obj.parentNode);
}
</script><div id="divtian">
<table>
<tr>
<td width="214"><label></label></td>
<td width="78">
待审核</td>
<td width="89"><label>
<input name="cl_price" type="text" size="10" />
</label></td>
<td width="88">优</td>
<td width="96"> </td>
<td width="119">
4-6 </td>
<td width="69">0-10</td>
<td width="64"><a href="javascript:ss(this)">删除</a></td>
</tr>
</table>
<table>
<tr>
<td width="214"><label></label></td>
<td width="78">
待审核</td>
<td width="89"><label>
<input name="cl_price" type="text" size="10" />
</label></td>
<td width="88">优</td>
<td width="96"> </td>
<td width="119">
4-6 </td>
<td width="69">0-10</td>
<td width="64"><a href="javascript:ss(this)">删除</a></td>
</tr>
</table> </div>
</body>
</html>
点击删除后链接所在的这个table 就没了,其他table还有
<div id="divtian">
<table>
<tr>
<td width="214"><label></label></td>
<td width="78">
待审核</td>
<td width="89"><label>
<input name="cl_price" type="text" size="10" />
</label></td>
<td width="88">优</td>
<td width="96"> </td>
<td width="119"> 4-6 </td>
<td width="69">0-10</td>
<td width="64"><a href="#" onclick="ss(this)">删除</a></td>
<!-- 这里改成onclick触发了,放在href里好像取不到this?? -->
</tr>
</table>
<table>
<tr>
<td width="214"><label></label></td>
<td width="78">
待审核</td>
<td width="89"><label>
<input name="cl_price" type="text" size="10" />
</label></td>
<td width="88">优</td>
<td width="96"> </td>
<td width="119"> 4-6 </td>
<td width="69">0-10</td>
<td width="64"><a href="#" onclick="ss(this)">删除</a></td>
</tr>
</table> </div> <SCRIPT LANGUAGE="JavaScript">
<!--
function ss(obj){
var tabObj = obj.parentElement.parentElement.parentElement.parentElement;
//a.td.tr.tbody.table
tabObj.style.display = "none";
}
//-->
</SCRIPT>
$(document).ready(function(){
$('#Div2').animate({'width':300,'background-color':'red'},1000);
$("a").click(function(){
$(this).parent().parent().remove();
});
});jquery的代码
{
//alert("sss");
obj.parentNode.parentNode.parentNode.style.display = 'none';
}
$('#Div2').animate({'width':300,'background-color':'red'},1000);
$("a").click(function(){
$(this).parent().parent().remove();
});
});
看3楼代码,倒数第5行的注释
//a.td.tr.tbody.table