<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PINTA CIRCULOS</title>
</head>
<body>
<canvas width="600" height="400"> </canvas>
<script>
var pantalla = document.querySelector("canvas");
var pincel = pantalla.getContext("2d");
pincel.fillStyle = "green";
pincel.fillRect(0, 0, 600, 400);
function exhibirAlerta(evento) {
var x = evento.pageX - pantalla.offsetLeft;
var y = evento.pageY - pantalla.offsetTop;
console.log(evento);
alert(x + "," + y);
}
function dibujoCirculo(evento) {
var x = evento.pageX - pantalla.offsetLeft;
var y = evento.pageY - pantalla.offsetTop;
pincel.fillStyle = "white";
pincel.beginPath();
pincel.arc(x, y, 15, 0, 2 * 3.14);
pincel.fill();
console.log(x + "," + y);
}
pantalla.onclick = dibujoCirculo;
</script>
</body>
</html>