Tôi đang cố gắng mở rộng tất cả các yếu tố dom để tôi có thể lấy và xóa con của họ. Hàm dưới đây (hoạt động trong FF và Chrome). Có tương đương trong IE7 để mở rộng đối tượng dom cơ sở?Element.prototype trong 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);
}
Cảm ơn!
dupe http://stackoverflow.com/questions/592815/is-there-really-no-way-to-expose-the-prototype-of-a-html-element-in-ie-8/ – bobince