这里我绑定输入图像的鼠标按下事件
this.canvas
是输入图像的ID。
但是按下图像时没有任何反应 onMouseDown函数不会被调用,但同样的事情在HTML页面中起作用。
this.canvas.onmousedown = this.onMouse_Down.bind(this);
this.canvas.onmouseup = this.onMouse_Up.bind(this);
为什么事件在cordova app中没有约束力?
如何绑定这些事件?
事件触摸事件不起作用: -
this.canvas.touchstart = this.onMouse_Down.bind(this);
this.canvas.touchend = this.onMouse_Up.bind(this);
=============事件列表器也无法正常工作========
funtion my_func(canvasName)
{
this.bDisabled = false;
this.canvas = document.getElementById(canvasName);
// add event listner
this.canvas.addEventListener('touchstart',this.onMouseDown);
this.canvas.addEventListener('touchend',this.onMouseUp);
}
my_func.prototype.onMouseDown = function()
{
alert('down');
alert(this.bDisabled);
}
mY_func.prototype.onMouseUp = function()
{
alert('up');
alert(this.bDisabled);
}
为什么alert(this.bdisable)
在按下输入图像时将输出设为undefined
&吗?