Finish the code at left so that a small (11 pixel wide) square is drawn at the mouse location each time the mouse is clicked.
<html>
<head>
<title>Mouse 01</title>
<script>
function init() {
var canv = document.getElementById("canv");
var ctx = canv.getContext("2d");
ctx.clearRect(0,0,300,200);
canv.addEventListener("mousedown",myMouseDownFunction);
}
function drawNewSquare(x,y) {
var canv = document.getElementById("canv");
var ctx = canv.getContext("2d");
// Code to draw square here
}
function myMouseDownFunction(event) {
// If we need to draw a square, figure out where, and get it done
}
</script>
</head>
<body onload="init();">
<h3>Your Canvas</h3>
<canvas id="canv" width="300" height="200" style="border:1px gray solid;">
</canvas>
<h3>Example Solution</h3>
<p>Not available</p>
</body>
</html>