摘要: 上下文对象在Javascript中,你的代码总是有一个上下文对象(代码处在该对象内),这是面向对象语言的常见特点。上下文对象是通过this变量来体现的,这个变量永远指向当前代码所处的对象中。例子:var obj = { yes: function(){ // this == obj this.val = true; }, no: function(){ this.val = false; }};// We see that there is no val property in the 'obj' objectalert( obj.val == nul... 阅读全文
posted @ 2012-09-17 15:49 zsheng823 阅读(149) 评论(1) 推荐(0) 编辑