<meta charset="UTF-8">
<canvas width="600" height="400"></canvas>
<script>
var canvas = document.querySelector("canvas");
var brush = canvas.getContext("2d");
brush.fillStyle = "lightblue";
brush.fillRect(0, 0, 600, 400);
function showCircle(event) {
var x = event.pageX - canvas.offsetLeft;
var y = event.pageY - canvas.offsetTop;
brush.fillStyle = "navy";
brush.beginPath();
brush.arc(x, y, 4, 0, Math.PI * 2);
brush.fill();
console.log(x + " , " + y);
}
canvas.onclick = showCircle;
</script>