日期:2014-05-16  浏览次数:20409 次

js方法(7)
if (typeof key == "string" && val === undefined) {
var attrs = [];
this.each(this, function (key) {
attrs.push(this.getAttribute(key));
}, key);
return attrs.join(",");
}
if (typeof key === "object") {
this.each(this, function (obj) {
for (var k in obj) {
this.setAttribute(k, obj[k]);
}
}, key);
return this;
}
}, width:function (val) {
var widths = [];
this.each(this, function (w) {
w.push(this.offsetWidth);
}, widths);
return widths.join(",");
}, height:function (val) {
var heights = [];
this.each(this, function (h) {
h.push(this.offsetHeight);
}, heights);
return heights.join(",");
}, next:function () {
var objs = [];
this.each(this, function (e) {
e.push(this);
}, objs);
new Array().splice.call(this, 0, this.length);
var i = 0;
this.each(objs, function (obj) {
var n = this.nextSibling;
while (n) {
if (n.nodeType === 1) {
obj[0] = n;
break;
}
n = n.nextSibling;
}
obj.length = 1;
}, this);
return this;
}};
jQuery.fn.init.prototype = jQuery.fn;
})();