类
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments); }
}
};
对象扩展
var Extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
};
获取DOM元素属性
var Attr = function (element, key, value) {
if(arguments.length == 2){
if(element.getAttribute){
return element.getAttribute(key) || element[key] || undefined;
}
}
else if(arguments.length == 3){
element.setAttribute(key,value);
}
};