点击图片,获取坐标 [英] Click an image, get coordinates

查看:336
本文介绍了点击图片,获取坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是可以做到的,我甚至对如何做到这一点有一个模糊的想法,但它停止了模糊。



我有一个标准的HTML图像标记其中有一个图像,大小为100×100像素。我希望人们能够点击图像,并将它们点击的X和Y传递给一个函数。



坐标需要相对于图像



预先感谢您的帮助。 解决方案

我认为你在谈论:

 < input id =infotype =image> 

提交时,x和y坐标的表单值基于输入元素id( info.x info.y 在这种情况下)。



http://www.w3。 org / TR / REC-html40 / interact / forms.html#h-17.4.1

I know it can be done and I even have a vague idea of how to do it but it stops at being vague.

I have a standard HTML image tag with an image in it, 100 by 100 pixels in size. I want people to be able to click the image and for that to pass the X and Y that they click into a function.

The coordinates need to be relative to the image top and left.

Thank you in advance for any help.

解决方案

I think you're talking about:

<input id="info" type="image">

When submitted, there are form values for the x and y coordinate based on the input element id (info.x and info.y in this case).

http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4.1

这篇关于点击图片,获取坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆