09 2012 档案

设计模式-装饰模式
摘要:装饰模式是为类添加额外的职责。在我看来,这些职责并不是某一个类特有,需要添加的类都可以添加,每个类没有必要单独添加这个职责。下面是我用js实现的装饰模式var Employee={ name: '', getName: function(){ return this.name; }, setName: function(name){ this.name = name; }, work: function(){}}function CosmeticsSalesEmployee(name){ this.name = name; ... 阅读全文

posted @ 2012-09-12 23:20 舟~ 阅读(190) 评论(0) 推荐(0)

公司网页监控到的各种不能识别的浏览器userAgent,都是些什么啊
摘要:ie是通过window.ActiveXObject特性来识别的mozilla/4.0(compatible;msie8.0;windowsnt6.1;trident/4.0;slcc2;.netclr2.0.50727;.netclr3.5.30729;.netclr3.0.30729;mediacenterpc6.0)mozilla/4.0(compatible;msie7.0;windowsnt5.1;trident/4.0;.net4.0c)mozilla/4.0(compatible;msie6.0;windowsnt5.1;sv1;.netclr1.1.4322)mozilla/4. 阅读全文

posted @ 2012-09-06 20:08 舟~ 阅读(4371) 评论(0) 推荐(0)

js模版引擎v6-注解
摘要:下面是小C的js模版引擎v6,写得非常精巧。先看一下怎么使用吧。var tpl = Template(options, helper).render(); html模版,分隔符分别是<&和&>,@会被解析为"data.",就是你的数据对象,避免了使用with。 <script type="tmpl" id="table_tmpl"> <&= title() &> <table border=1> <& for(var i=0,tl = @tr 阅读全文

posted @ 2012-09-03 22:36 舟~ 阅读(312) 评论(0) 推荐(0)