如何从DOM中删除对象? [英] How a delete a object from DOM ?

查看:56
本文介绍了如何从DOM中删除对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个4row x 1col表,我想放下行的所有内容

三。

由于Mac IE5.2不支持deleteRow方法,

我也尝试设置innerHTML ='''';但它不起作用。


如何以其他方式从DOM中删除节点?

谢谢。

I have a 4row x 1col table, I would like to drop all the content of row
three.
Since Mac IE5.2 does not suppport deleteRow method,
I have also try to set the innerHTML=''''; but it does not work.

How can I delete the node from DOM in other way?
Thanks.

推荐答案

Cylix写道:
Cylix wrote:

我有一个4row x 1col表,我想删除所有内容行

三。

由于Mac IE5.2不支持deleteRow方法,

我也尝试设置innerHTML ='' '';但它不起作用。


如何以其他方式从DOM中删除节点?

谢谢。
I have a 4row x 1col table, I would like to drop all the content of row
three.
Since Mac IE5.2 does not suppport deleteRow method,
I have also try to set the innerHTML=''''; but it does not work.

How can I delete the node from DOM in other way?
Thanks.



哦,对不起,我已经找到了这样做的方法...


假设行是要删除的对象:

row.parentNode.removeChild(row);

Oh, Sorry, I found the way to do so already ...

Suppose "row" is the object going to delete:
row.parentNode.removeChild(row);


Cylix写道:
Cylix wrote:

我有一个4row x 1col表,我想放弃行的所有内容

三。

自Mac IE5.2不支持deleteRow方法,

我也尝试设置innerHTML ='''';但它不起作用。


如何以其他方式从DOM中删除节点?

谢谢。
I have a 4row x 1col table, I would like to drop all the content of row
three.
Since Mac IE5.2 does not suppport deleteRow method,
I have also try to set the innerHTML=''''; but it does not work.

How can I delete the node from DOM in other way?
Thanks.



你不能删除< TR from< TBODY> ;?例如。对于第三行,如果

tbody引用TBODY元素:


tbody.removeChild(tbody.childNodes [2]);


Ray

Can''t you remove the <TRfrom the <TBODY>? E.g. for the third row, if
tbody refers to the TBODY element:

tbody.removeChild(tbody.childNodes[2]);

Ray


Cylix写道:
Cylix wrote:

我有4row x 1col表,我想删除行的所有内容

三。

由于Mac IE5.2不支持deleteRow方法,

我也尝试设置innerHTML ='''';但它不起作用。


如何以其他方式从DOM中删除节点?

谢谢。
I have a 4row x 1col table, I would like to drop all the content of row
three.
Since Mac IE5.2 does not suppport deleteRow method,
I have also try to set the innerHTML=''''; but it does not work.

How can I delete the node from DOM in other way?
Thanks.



双行函数库:

< script>

函数

Two-line function library:
<script>
function


这篇关于如何从DOM中删除对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆