<script type="text/javascript" >
var name = '高伟刚';
var person = {
name : 'gao',
sayName : function(){
alert(this.name);
}
};
var p = person.sayName;//this的值不能维持,改为指向window
p();//'高伟刚'
person.sayName();//'gao',this指向person对象
/*由上面的可以推倒出下面的结果*/
(person.sayName = person.sayName)();//'高伟刚'
(person.sayName = function(){
alert(this.name);
})();//'高伟刚'
</script>