Code:
var isIE = document.all?true:false; if(document.getElementById("ctl00_cphContent_imgMap") != null ) { document.getElementById("ctl00_cphContent_imgMap").onmousedown = getMousePosition; } function getMousePosition(e) { var _x; var _y; if (!isIE) { _x = e.pageX ; _y = e.pageY } if (isIE) { _x = event.clientX + document.body.scrollLeft; _y = event.clientY + document.body.scrollTop; } posX=_x; posY=_y; }
I call the function from an img onmousedown event I'm able to get the coordiantes in IE and am also able to get it in mozilla too when I getmouseposition onmousedown for the entire body(document.onmousedown) and not just the image area in the body...help appreciated