摘要:
关键字 thisthis 的功能在 ECMAScript 中,要掌握的最重要的概念之一是关键字 this 的用法,它用在对象的方法中。关键字 this 总是指向调用该方法的对象,例如:var oCar = new Object;oCar.color = "red";oCar.showColor = function() { alert(this.color);};oCar.showColor(); //输出 "red"在上面的代码中,关键字 this 用在对象的 showColor() 方法中。在此环境中,this 等于 oCar。下面的代码与上面的代码 阅读全文
posted @ 2011-11-30 11:07
大浩子
阅读(212)
评论(0)
推荐(0)