如果id为"foo"的对象有子节点,移出其内部的第一个子节点,
var foo = document.getElementById("foo")
if (foo.hasChildNodes()) {
foo.removeChild(foo.childNodes[0]);
}
Note that element.hasChildNodes, without the parenthesises, will return the hasChildNodes Function, and not a Boolean.
Page last modified 03:49, 22 Dec 2006 by Xiaobian?