
临时需要检测鼠标点击位置在图片中的坐标,javascript,firefox不响应offset函数,仅ie有效.
<script>
function getcoords()
{
document.getElementById("ids").value += event.offsetX+","+event.offsetY+"\n";
}
</script>
<img src= "a.jpg" width=1200 height=800 onclick= "getcoords();">
<textarea id="ids" rows=100 cols=100>
</textarea>
No comments :
Post a Comment