摘要:
Base.prototype.addClass = function (className) { for (var i = 0; i < this.elements.length; i ++) { if (!this.elements[i].className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'))){ this.... 阅读全文
摘要:
function Base() { //把返回的节点对象保存到一个Base 对象的属性数组里 this.elements = []; //获取id 节点 this.getId = function (id) { this.elements.push(document.getElementById(id)); return this; }; //获取name 节... 阅读全文
摘要:
var Base = { //整个库可以是一个对象 getId : function (id) { //方法尽可能简短而富有含义 return document.getElementById(id); }, getName : function (name) { return document.getElementsByName(nam... 阅读全文