摘要: function $package(name) { //拆分名字空间域字符串 var domains = name.split("."); var cur_domain = window; //循环遍历每一级子域 for(var i=0; i< domains.length; i++) { var domain = domains[i]; //如果该域的空间未被创建 if(typeof(cur_domain[domain]) == ... 阅读全文
posted @ 2012-04-03 23:24 水之原 阅读(1198) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.each = function(fn) { return this.length ? [fn(this.slice(0,1))].concat(this.slice(1).each(fn)) : []; }; [1,2,3,4].each(function(x){ document.write(x + "<br/>"); }); 阅读全文
posted @ 2012-04-03 22:11 水之原 阅读(2268) 评论(0) 推荐(0) 编辑