js方法(4)
}
}, empty:function (dels) {
if (dels === undefined) {
for (var i = 0; i < this.length; i++) {
while (this[i].firstChild) {
this[i].removeChild(this[i].firstChild);
}
}
} else {
for (var i = 0; i < dels.length; i++) {
while (dels[i].firstChild) {
dels[i].removeChild(dels[i].firstChild);
}
}
}
}, html:function (val) {
if (val === undefined) {
var htmls = [];
this.each(this, function (val) {
htmls.push(this.innerHTML);
}, val);
return htmls.join(",");
} else {
this.each(this, function (val) {
this.innerHTML = val;
}, val);
}
}, each:function (object, callback, param) {
for (var i = 0; i < object.length; i++) {
callback.call(object[i], param);
}
}, append:function (content) {
if (content !== undefined && !isHtml.test(content)) {
for (var i = 0; i < this.length; i++) {
var textNode = this[i].ownerDocument.createTextNode(content);
this[i].appendChild(textNode);
return this;
}
} else {
if (isHtml.test(content)) {
this.each(this, function (obj) {