日期:2014-05-16  浏览次数:20355 次

this 问题
看了下边的代码
<input   type=checkbox   id=myChk   value=1>   Test?
<script>
//declaring   the   class
var   CheckboxWatcher   =   Class.create();
//defining   the   rest   of   the   class   implementation
CheckboxWatcher.prototype   =   {
initialize:   function(chkBox,   message)   {
this.chkBox   =   $(chkBox);
this.message   =   message;
//assigning   our   method   to   the   event

this.chkBox.onclick   =
this.showMessage.bindAsEventListener(this);   //参数中的this代表的是什么啊?

},
showMessage:   function(evt)   {
alert(this.message   +   '   ( '   +   evt.type   +   ') ');
}
};
var   watcher   =   new   CheckboxWatcher( 'myChk ',   'Changed ');
</script>
其他的this   代表的是方法对象?还是参数啊?

问的问题比较初级,不过我会努力的。希望多指点。。。谢谢

------解决方案--------------------
指对象CheckboxWatcher
------解决方案--------------------
http://blog.csdn.net/haluomao/archive/2005/10/12/500954.aspx

JavaScript中this关键字使用方法详解