I've got an image, which act as a map and i need to find the coordinate relative to the img when user click on it.
I've successfully manage to get the document coord (x & y) but can't get the img coord, any idea ?
Code:function GetCoord(e) { var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft; var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop; x = x - document.frmAjout.imgCarte.scrollLeft; y = y - document.frmAjout.imgCarte.scrollTop; document.frmAjout.txtCoordX.value = x; document.frmAjout.txtCoordY.value = y; }




Reply With Quote