一样用这个简单的绘图板范例
http://www.blogjava.net/crazycoding/archive/2013/09/13/404016.html
如果我要在网页里实做两块绘图板
该怎么让他们分别作用呢?
我修改
canvas = document.getElementById('imageView');
context = canvas.getContext('2d');
canvas2 = document.getElementById('imageView2');
context2 = canvas2.getContext('2d');
tool = new tool_pencil();
canvas.addEventListener('mousedown', ev_canvas, false);
canvas.addEventListener('mousemove', ev_canvas, false);
canvas.addEventListener('mouseup', ev_canvas, false);
canvas2.addEventListener('mousedown', ev_canvas, false);
canvas2.addEventListener('mousemove', ev_canvas, false);
canvas2.addEventListener('mouseup', ev_canvas, false);
之后作的操作都依照各自绘图板的座标 画到了第一块板子上XD
能请指点一下问题所在吗?
感谢!