代码如下,我想得到MyDrag的cdiv属性 应该怎么得到啊 ,直接用this.cdiv是不行的,因为是在handMouseDown事件里面,this指向的不是MyDrag对象。我知道原因了,但是不知道要怎么解决。请个位大哥大姐帮帮忙吧。。拜托了var MyDrag = function (cdiv)
{
this.cdiv = cdiv;
};MyDrag.prototype.handMouseDown = function(e)
{
e = e || event;
var v_div = this.cdiv; //这里有错
}
{
this.cdiv = cdiv;
};MyDrag.prototype.handMouseDown = function(e)
{
e = e || event;
var v_div = this.cdiv; //这里有错
}
看看function MyDrag (cdiv)
{
this.cdiv = cdiv;
}; MyDrag.prototype.handMouseDown = function(e)
{
e = e || event;
var v_div = this.cdiv; //这里有错 }
var MyDrag = function (cdiv)
{
this.cdiv = cdiv;
};MyDrag.prototype.handMouseDown = function(e)
{
e = e || window.event;
var v_div = this.cdiv; //这里有错
}
var drag = new MyDrag("div");
drag.handMouseDown();
MyDrag.prototype.handMouseDown = function(e)
{
e = e || window.event;
var v_div = this.cdiv; //这里有错
}因为在这里面 this指向的并不是MyDrag所以我想知道的是 有没有方法可以在 这个函数里面 得到 MyDrag的属性