JavaScript的removeNode()在Chrome中不起作用

5 javascript dom google-chrome

我需要从页面中删除一个节点,为此我使用下面提到的函数

document.getElementById(id).removeNode(true);

该函数在 IE 中工作正常,但在 Chrome 中不行。谁能告诉我应该怎么做?

Jos*_*ger 3

您可以使用removeChild,它适用于大多数浏览器