我在图像上有一个HTML5绘制画布,允许用户在图像上绘制点:
JAVASCRIPT
var sketcher = null;
var brush = null;
$(document).ready(function(e) {
brush = new Image();
brush.src = 'assets/brush2.png';
brush.onload = function(){
sketcher = new Sketcher( "sketch", brush );
}
});
HTML
<canvas id="sketch" width="1024" height="687" />
<canvas id="draw"/>
<div class="id1462-Main-Window"><img src="images/1462_Main_Window.jpg"
width="1024"height="687" alt=""/>
我正在尝试添加一个功能,当用户在画布区域中单击/绘制一个点时,计数器会逐步增加+1。
<p id="counter_text"><span>0</span></p>
答案 0 :(得分:0)
$(function(){
canvas.addEventListener('click', function() {
$("#counter_text").val($("#counter_text").val() += 1);
}, false);
});