<tr>
<td width="10%">
<s:property value="#owner.id" />
</td>
<td width="20%">
<s:property value="#owner.name" />
</td>
<td width="15%">
<s:property value="#owner.floor" />
</td>
<td width="15%">
<s:property value="#owner.number" />
</td>
<td width="20%">
<s:property value="#owner.telephone" />
</td>
<td width="20%" align="center">
<a href="addOwner.jsp">添加</a>|
<a href="javascript:void(0)" onclick="updateOwner(<s:property value="#owner.id" />,'<s:property value="#owner.name" />','<s:property value="#owner.floor" />','<s:property value="#owner.number" />','<s:property value="#owner.telephone" />')">
修改</a>|
<a href="javascript:void(0)" onclick="deleteOwner('<s:property value="#owner.id" />',this)">删除</a>
</td>
</tr>
function deleteOwner(id,obj){
var o=$(obj);
if(confirm("确定删除?")){
$.post(
"deleteOwner!deleteOwner",
{id: id},
function(){
alert("删除成功!!!");
o.parents("tr").remove();
}
);
}
}
1.刚开始因为this放错位置了,死活不成功!得注意。
2.直接用obj报错,要将其打包成对象$(obj)