나는 모든 DOM 요소를 확장하여 자녀를 가져오고 제거 할 수 있습니다. 이 기능은 아래에 있습니다 (FF 및 Chrome에서 작동). 기본 DOM 객체를 확장하기 위해 IE7에 상응하는 것이 있습니까?입니까?
if (!Element.get) {
Element.prototype.get = function(id) {
for (var i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i].id == id) {
return this.childNodes[i];
}
if (this.childNodes[i].childNodes.length) {
var ret = this.childNodes[i].get(id);
if (ret != null) {
return ret;
}
}
}
return null;
}
}
Element.prototype.removeChildren = function() {
removeChildren(this);
}
감사!
속는 http://stackoverflow.com/questions/592815/is-there-really-no-way-to-expose-the-prototype-of-a-html-element-in-ie-8/ – bobince