一个搜寻节点并删除添加的问题!
<html>
<body>
<table>
<!-- 这里可能有很多的trtd -->
<tr>
<td> </td>
<td>
<textarea id= "replyContent " name= "content " > </textarea>
</td>
</tr>
<tr>
<td> HAHA </td>
<td>
<div>
<script language= "javascript ">
document.write( 'Test ');
</script>
</div>
</td>
</tr>
</table>
<script type= "text/javascript ">
function $(objid)
{
return document.getElementById(objid);
}
alert( $( "replyContent ").parentNode.parentNode.innerHTML );
//请问怎样在这里删除 "HAHA "所在的那个tr,td,div?
//我并不知道其tr,td的id,只知道那个textarea的。
//本来想可能有个nextNode,结果失败了
</script>
</body>
</html>
------解决方案-------------------- <html>
<head>
</head>
<body>
<table border=1>
<!-- 这里可能有很多的trtd -->
<tr>
<td> </td>
<td>
<textarea id= "replyContent " name= "content " > </textarea>
</td>
</tr>
<tr>
<td> HAHA </td>
<td>
<div>
<script language= "javascript ">
document.write( 'Test ');
</script>
</div>
</td>
</tr>
</table>
<div > <input type= "button " id= "btn1 " value= "delete "> </div>
<script>
document.getElementById( "btn1 ").onclick=function(){
var tds=document.getElementsByTagName( "td &q