摘要: Thethisvalueintheglobalexecutioncontext,referstotheglobalobject,e.g.:this===window;//trueForFunctionCode,itreallydependsonhowdoyouinvokethefunction,forexample,thethisvalueisimplicitlysetwhen:Callingafunctionwithnobaseobjectreference:myFunc();Thethisvaluewillalsorefertotheglobalobject.Callingafunctio 阅读全文
posted @ 2013-01-16 17:12 arthur_d 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1 function counter(n){ //Function argument n is the private variable 2 return{ 3 //Property getter method returns and increments private counter var. 4 get count(){return n++;}, 5 //Property setter doesn't allow the value o... 阅读全文
posted @ 2013-01-15 16:14 arthur_d 阅读(183) 评论(0) 推荐(0) 编辑
摘要: JavaScript is a lexically scoped language: the scope of a variable can be thought of as the set of source code lines for which the variable is defined. Global variables are defined throughout the program.Local variables are defined throughout the function in which they are declared, and also within 阅读全文
posted @ 2013-01-14 20:06 arthur_d 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 1 uniqueInteger.counter = 0;2 function uniqueInteger(){3 return uniqueInteger.counter++;4 }we defined a uniqueInteger() function that used a property of the function itself to keep track of the next value to be returned. A shortcoming of that approach is that buggy or malicious code could reset ... 阅读全文
posted @ 2013-01-14 19:58 arthur_d 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1.首先去下载主题包:http://download.savannah.gnu.org/releases/color-theme/注:下载.zip结尾的文件。2.在C:\Users\用户名\AppData\Roaming\.emacs.d下创建文件夹plugins(注:用户名对应你的计算机用户名)3.将color-theme-6.6.0.zip解压得到的文件夹color-theme-6.6.0放到plugins下。4.打开runemacs.exe ,按 c-x c-f ~/.emacs5.打开.emacs之后,将如下复制进去:(setq load-path (append load-path 阅读全文
posted @ 2012-07-31 19:47 arthur_d 阅读(307) 评论(0) 推荐(0) 编辑
摘要: JavaScript 的命名空间并不是真正的命名空间, 只是在脚本内部创建一个封闭的小空间, 必须通过特定的空间名称才能对空间内部的代码进行访问, 这样可以防止同名函数和变量发生冲突, 也可以更方便地管理代码, 就像 .NET 的命名空间 (namespace) 和 Java 的包 (package) 一样.为什么需要命名空间? 1. JavaScript 是不会禁止你重复定义函数和变量的, 但他只会使用最后定义的版本, 也就是说, 这将导致前面的失效, 令系统出错. 比如, $(id) 是最常用的, 也许你会毫不犹豫的在自己的脚本上定义这个函数, 但是当你用上 prototype, 你就会发 阅读全文
posted @ 2012-06-06 17:25 arthur_d 阅读(138) 评论(0) 推荐(0) 编辑
摘要: jQuery为开发插件提拱了两个方法,分别是:JavaScript代码jQuery.fn.extend(object);jQuery.extend(object); jQuery.extend(object); 为扩展jQuery类本身.为类添加新的方法。jQuery.fn.extend(object);给jQuery对象添加方法。fn 是什么东西呢。查看jQuery代码,就不难发现。JavaScript代码jQuery.fn = jQuery.prototype = { init: function( selector, context ) {//…. //…… }; 原来 jQ... 阅读全文
posted @ 2012-06-06 17:24 arthur_d 阅读(128) 评论(0) 推荐(0) 编辑