我创建了一个对象obj:
function a(id, ...){
this.id = id;
......
}
var obj = new a("#somediv", ...);
我有这个功能:
a.prototype.b = function(){
$(this.id+" span").mouseover(function(){
$(this.id).addClass("c");
});
};
显然,this鼠标悬停函数中的指向span而不是obj...
我知道我可以通过创建一个变量并获取this.idbut的属性来解决这个问题
有没有办法让this鼠标悬停功能指向obj呢?