Ummm...you only mentioned *ONE* <div>.
a <div> tag that will act as a grid over the canvas
So you are saying you just want to know where IN THAT ONE <div> that the user clicked?
Then what in the heck was the purpose of showing that useless dummy array??? If I think too literally, you write too irrelevant?
Not hard, but if you want to worry about older MSIE you have to write one very tiny line of conditional code.
border: solid blue 3px;
var div = document.getElementById("overlay");
div.onclick = showWhere;
function showWhere( evt )
if ( evt == null ) evt = window.event; // handle older MSIE
// find where the click occurred
var x = evt.clientX;
var y = evt.clientY;
// but those are absolute on the screen
// we need to find them relative to the div
var node = div;
while ( node != null )
x -= node.offsetLeft;
y -= node.offsetTop;
node = node.offsetParent;
alert("You clicked at x=" + x + ", y=" + y + " within the div");