- , canvas.addEventListener onclick funion . IE, FF, Chrome.
canvas.addEventListener('mousedown', ev_canvas, false);
function ev_mousedown(ev){
var posx=0;posy=0;
if (e.offsetX > 0) {
posx = e.offsetX;
posy = e.offsetY;
} else{
posx = e.layerX;
posy = e.layerY;
}
}
<div style="position: relative;">
<canvas id="canvas" width="600" height="600" onClick="newClick()" style="position: relative;"></canvas>
</div>
. : http://dev.opera.com/articles/view/html5-canvas-painting/
Firefox.
showNote = function(evt) {
evt = evt || window.event;
var note1=document.getElementById('note1');
note1.style.left=evt.clientX;
note1.style.top=evt.clientY;
note1.style.visibility='visible'
}
I have google for many solutions and the link to the relatively official site for bros is different: http://www.quirksmode.org/dom/w3c_cssom.html#mousepos
But still no solution has been found in Firefox 20. window.event has no definition in FF. But it works well in IE and Chrome.
Interestingly, I understood something in this matter?
source
share