随笔分类 - Javascript
摘要:看到一篇[关于AngularJS Backbone Ember.js的对比](http://www.airpair.com/js/javascript-framework-comparison),建议看一看说说个人的观点(本人学艺不精,只是个人的观点,不保证观点完全正确,请轻拍):1. backbo...
阅读全文
摘要:JS原生并没有提供方便使用的Formatter函数,用字符拼接的方式看起来混乱难读,而且使用起来很不方便。个人感觉C#里提供的语法比较好用,如: String.Format(“Welcome to learn '{0}','{0}' is awesome,you will {1} it!","...
阅读全文
摘要:《45 Useful JavaScript Tips, Tricks and Best Practices》http://flippinawesome.org/2013/12/23/45-useful-javascript-tips-tricks-and-best-practices/1 – Don’t forgetvarkeyword when assigning a variable’s value for the first time.Assignment to an undeclared variable automatically results in a global variab
阅读全文
摘要:转自:http://berzniz.com/post/68001735765/javascript-hacks-for-hipstersJavascript Hacks for HipstersJavascript is so much fun, except when it’s not.There’s always the fear of runtime errors that keeps us thinking all the time while writing code. It makes us better coders - we have no other option than
阅读全文
摘要:转自:博客园Wayouhttp://www.cnblogs.com/Wayou/p/javascript_arguments_passing_with_reference.html变量1.JavaScript hoisting>>请看例子,我们拿Chrome的console作为JS的运行环境。上面直接执行console.log(a), 不带一点悬念地抛出了not defined 错误。这是预料之中的。看下面进化后的代码:之前变量没有定义的错误没了,取而代之的是告诉我们a的值是 'undefined'。先不管a的值缘何为 'undefined' 了,至
阅读全文
摘要:以前一个现在不用的帐号发布的随笔,现在人肉搬过来吧。。。注册用户有一段时间了,一直很忙,到现在还没有写一篇,忽然觉的一定要花点时间记录和总结一些东西。好吧,就从这里开始了。 今天客户提出要点击菜单(TreeView实现的)的父级节点时,展开节点。心想这个应该是很常见的功能吧,特意google了一下,发现大部分是将的不是js实现的,有些js实现的写的麻烦,干脆自己写一个吧,应该不难的。 首先思路是,,让文本点击的时候执行左边‘+’号的事件,查看源码看到,‘+’号的事件是:javascript:TreeView_ToggleNode(ctl00_body__menuTree_Data,0,docu
阅读全文