日期:2014-05-16 浏览次数:20379 次
<!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=GBK" />
<title>测试</title>
<script type="text/javascript" src="jquery-1.4.js"></script>
<script>
function deleteTest(){
var dd =$('[id=aa]');
for(var i=0;i<dd.length;i++){
var bb = dd[i];
bb.deleteCell();
}
}
</script>
</head>
<body>
<table>
<tr>
<td style="cursor:pointer;" onclick=javascript:deleteTest();>删除</td>
</tr>
</table>
<table>
<tr id="bb" ><td><img src=\"/images/item.png\"/></td><td>aaaaaaa</td></tr>
<tr id="aa" ><td><img src=\"/images/item.png\"/></td><td>aaaaaaa</td></tr>
<tr id="aa"><td>bbbbbb</td><td><img src=\"/images/item.png\"/></td></tr>
<tr id="aa"><td>ccccccccc</td><td><img src=\"/images/item.png\"/></td></tr>
</table>
</body>
</html>
function deleteTest(){
var dd =$('[id=aa]');
for(var i=0;i<dd.length;i++){
var bb = dd[i];
$(bb).remove();
}
}
function deleteTest(){
//获取指定id的元素
var target = $('#aa');
//删除tr本身(根据id获取只会获取一个,不需要遍历)
target.remove();
}