上下文对象

function myTest()

{

      this.context=this.constructor;

}

 

myTest(); // must be invoke, if not, alert(context)  bug show: context is not defined.

alert(context); //context is window

 

var o =new myTest();

alert(context);  //context is window

alert(o.context);  // context is myTest object

 

posted @ 2011-12-15 14:13  Yu  阅读(128)  评论(0编辑  收藏  举报